Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
CSIDE and OScript
Global variables?
DeloitteAdmin_(Delete)_2707331
HI,I am trying to create a cursor in a script within my new ospace, but for some reason the cursor is not created..I have a feeling it is because I have not added the LLIAPI object to globals?Do I need to make the LLIAPI object global in order to access it from my ospace, the syntax I am using is shown below, I copied this from the Builder Help docs..cursor = $LLIAPI.DbCursor.New( \If I need to make it global what do I need to do? Thanks Asha
Find more posts tagged with
Comments
David_Barker_(americ02user3_-_(deleted))
Asha,The $ sign before the LLIAPI means that it already is a global variable, so you don't have to make another one locally or anywhere else.You can either use the "Inspect Global Variables" from the "Tools" menu I believe it is, to Inspect the $LLIAPI object directly or simply set a Breakpoint in your code and "Step-In" to the $LLIAPI.DbCursor.New () function when you get to it.You can set a temporary breakpoint during your debugging by double-clicking on the line where you want to set the breakpoint. You will then get a red marker on that line and you then can select the "Go" button to jump down to that specific line so that you aren't idly clicking you life away.If you aren't getting an error when the routine is called then you are most likely sending in some incorrect parameters or a bad SQL statement. You will be able to see this when you Step-Into the function call. If the Builder couldn't find the $LLIAPI.DbCursor.New() call then it would have failed with a failure.By the way, the way to read this reference is... (from right to left)Execute the "New()" script feature of the "DBCursor" global variable located within the "LLIAPI" Ospace's Globals object.Hope this helps,Dave
DeloitteAdmin_(Delete)_2707331
HI David,When I have the following:cursor = $LLIAPI.DbCursor.New( \ dbConnect, \ "select * from testForm where VersionNum = -1")The cursor is created and returns data from the DB... but when I try to add another variable to this select string as shown below..I get an error saying the cursor was not created..I am trying to compare the subWorkID passed into the function "Assign Managers" to the VolumeID of the SQL table "testForm"Could you tell me how to do that and what I am doing wrong? Or perhaps point me to some documentation which might help me?Thanks,AshaFunction Dynamic AssignManagers( \ Object prgCtx, \ WAPIWORK work, \ Integer workID, \ Integer subWorkID, \ Integer taskID, \ Integer returnSubWorkID, \ Integer returnTaskID, \ Dynamic extraData = Undefined ) Dynamic retVal Object cursor Record rec Object dbConnect = prgCtx.fDbConnect cursor = $LLIAPI.DbCursor.New( \ dbConnect, \ "select * from testForm where VersionNum = -1 and VolumeID = subWorkID")
John W. Simon, Jr.
Why not create the statement before trying to create the cursor...something likestmt = "SELECT providerID, providerdata FROM ProviderData "stmt += "WHERE providerid >= " + dir[3:-1] + '000000 'stmt += "AND providerid <= " + dir[3:-1] + '999999'pCursor = SQL.Declare( sqlCnct, stmt )
David_Barker_(americ02user3_-_(deleted))
That is on the right track, and I too like to break up my statements into the major components so that it is readable and maintainable. But this can be more expressed more elegant by using a Str.Format () call... like this.stmt = "SELECT providerID, providerdata FROM ProviderData "stmt += "WHERE providerid >= %1"stmt += "AND providerid <= %2"dbstmt= Str.Format ( stmt, dir[3:-1] + '000000 ', dir[3:-1] + '999999' )pCursor = SQL.Declare( sqlCnct, dbstmt )Or like a C/Perl programmer would do...pCursor = SQL.Declare( sqlCnct, Str.Format ( stmt, dir[3:-1] + '000000 ', dir[3:-1] + '999999' ))This will put your variable values into the statement and it is very maintenance friendly since it is readable.Also, you don't necessarily need a cursor, you can also use a CAPI.Exec () or CAPI.ExecN () call. Check out the documentation that comes with the Builder for more info on these.
eLink User
Message from Alex Kowalenko via eLinkCursors are handy when the result set may be large. Check out theLLIAPI.LLIAPI Root.APIObjects.DbCursor object (called via $LLIAPI.DbCursor)for simplified database cursor methods. Its Documentation feature has someilluminating description.-alex------Original Message-----From: eLink Discussion: Livelink Builder Discussion[mailto:componentbuilder@elinkkc.opentext.com]Sent: Thursday, March 18, 2004 3:10 PMTo: eLink RecipientSubject: SQL Statement Variables...SQL Statement Variables...Posted by Barker, David on 03/18/2004 03:09 PMThat is on the right track, and I too like to break up my statements intothe major components so that it is readable and maintainable. But this canbe more expressed more elegant by using a Str.Format () call... like this.stmt = "SELECT providerID, providerdata FROM ProviderData "stmt += "WHERE providerid >= %1"stmt += "AND providerid <= %2"dbstmt= Str.Format ( stmt, dir[3:-1] + '000000 ', dir[3:-1] + '999999' )pCursor = SQL.Declare( sqlCnct, dbstmt )Or like a C/Perl programmer would do...pCursor = SQL.Declare( sqlCnct, Str.Format ( stmt, dir[3:-1] + '000000 ',dir[3:-1] + '999999' ))This will put your variable values into the statement and it is verymaintenance friendly since it is readable.Also, you don't necessarily need a cursor, you can also use a CAPI.Exec ()or CAPI.ExecN () call. Check out the documentation that comes with theBuilder for more info on these.[To reply to this thread, use your normal E-mail reply function.]============================================================Topic: Global variables?
https://knowledge.opentext.com/knowledge/livelink.exe?func=ll&objId=3380074&objAction=viewDiscussion
: Livelink Builder Discussion
https://knowledge.opentext.com/knowledge/livelink.exe?func=ll&objId=765419&objAction=viewLivelink
Server:
https://knowledge.opentext.com/knowledge/livelink.exe
eLink User
Message from Alex Kowalenko via eLinkThe SQL statement must include a bind variable and the call to$LLIAPI.DbCursor.New must include the value to bind as the 3rd argument. Forexample: cursor = $LLIAPI.DbCursor.New( \ dbConnect, \ "select * from testForm where VersionNum = -1 and VolumeID =:A1", \ { subWorkID } )-alex------Original Message-----From: eLink Discussion: Livelink Builder Discussion[mailto:componentbuilder@elinkkc.opentext.com]Sent: Thursday, March 11, 2004 10:28 AMTo: eLink RecipientSubject: Can you tell me how to pass a variable to sql string..Can you tell me how to pass a variable to sql string..Posted by DeloitteAdmin on 03/10/2004 05:46 PMHI David,When I have the following:cursor = $LLIAPI.DbCursor.New( \ dbConnect, \ "select * from testForm where VersionNum = -1")The cursor is created and returns data from the DB... but when I try to addanother variable to this select string as shown below..I get an error sayingthe cursor was not created..I am trying to compare the subWorkID passed into the function "AssignManagers" to the VolumeID of the SQL table "testForm"Could you tell me how to do that and what I am doing wrong? Or perhaps pointme to some documentation which might help me?Thanks,AshaFunction Dynamic AssignManagers( \ Object prgCtx, \ WAPIWORK work, \ Integer workID, \ Integer subWorkID, \ Integer taskID, \ Integer returnSubWorkID, \ Integer returnTaskID, \ Dynamic extraData = Undefined ) Dynamic retVal Object cursor Record rec Object dbConnect = prgCtx.fDbConnect cursor = $LLIAPI.DbCursor.New( \ dbConnect, \ "select * from testForm where VersionNum = -1 and VolumeID =subWorkID")[To reply to this thread, use your normal E-mail reply function.]============================================================Topic: Global variables?
https://knowledge.opentext.com/knowledge/livelink.exe?func=ll&objId=3380074&objAction=viewDiscussion
: Livelink Builder Discussion
https://knowledge.opentext.com/knowledge/livelink.exe?func=ll&objId=765419&objAction=viewLivelink
Server:
https://knowledge.opentext.com/knowledge/livelink.exe