The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Is a creating a Global Array possible?
Posted: 04 Sep 07 6:44 AM
|
I am getting a subscript out of range error when trying to pass a global array. Is this not possible? I'd like to not have to write the array to a temp file first. Here is a sample of what I am trying to do.
Dim aryList(20) For i = 0 to 19 aryList(i) = "Array item " & i Next
Application.GlobalInfo.Add "gbl_aryList", aryList()
Thank you. |
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 9:35 AM
|
Haven't tried this, but how about this:
Application.GlobalInfo.Add "gbl_aryList", aryList [No parenthesis?]
Also, you could build a Delimited String and then Split it into an Array |
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 9:40 AM
|
I had that same thought as you suggested without the parens, but that doesn't work either. In the meantime, I populated a hidden listbox on the source view, and upon opening my other view, pulled the items from it, as shown here...
Set objfrmPrintPro = Application.Forms("Contact:PrintPro") lbItems.Items = objfrmPrintPro.lbTemp.Items Set objfrmPrintPro = Nothing
This works, but I'd still rather be able to pass the variable as an array if anyone knows. Your string suggestion is a good workaround too. Thank you, Raul. |
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 9:58 AM
|
If you have gone thru the trouble of getting a reference to the Form, then you might as well do as follows: On the PrintPro form, make sure your Array is declared with Global Scope Instead of getting a reference to the Label, get a reference to the Global Array:
Set objfrmPrintPro = Application.Forms("Contact:PrintPro") Set Arr = objfrmPrintPro.Script.MyArray() Set objfrmPrintPro = Nothing |
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 10:11 AM
|
Sounds like a good option, Raul, but I get an error on the Set Arr line stating Object doesn't support this property or method. Tried it without the parens, same error. |
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 10:16 AM
|
First of all, my apologies, I am not testing it on SLX.
If you cant retreive it, can you traverse it directly thru the form reference? Still better than having to use the listbox.
|
|
|
| |
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 10:43 AM
|
I was having the same problems.......finally ended up passing a String of stuff in 'item1', 'item2', 'item3' format......then I can Replase and SPLIT it on the other side/form......or use it in a SQL WHERE clause....... IN('item1', 'item2', 'item3' )
|
|
|
|
Re: Is a creating a Global Array possible?
Posted: 04 Sep 07 11:55 AM
|
Originally posted by Paul VanderWaal
Sounds like a good option, Raul, but I get an error on the Set Arr line stating Object doesn't support this property or method. Tried it without the parens, same error. |
|
Remove the "Set" part. An array is a technically an object, so there is no reference to set. |
|
|
| |
|
Re: Is a creating a Global Array possible?
Posted: 05 Sep 07 12:59 AM
|
I have stored & retrieved ADO recordset objects in SLX global variables.
I was using a disconnected recordset as a data structure because I was using it to share information between a Cypress basic script an a VBScript so did nto think I could pass an array back and forth.
I may have been using the older application.basicfunctions.globalxxxxx functions rather than the newer application.globalinfo collection, maybe there is a subtle difference, I'm not sure.
If I had that code handy I would post it - I'll look for it, not sure if I will be able to find it soon, but thought I might suggest the disconnected recordset object as an alternative as well as assure you that COM objects can be stored & retrieved from the SLX Global variable space.
Todd |
|
|
|