11-28-2006 10:35 AM
11-29-2006 09:30 AM
Hi kaan,
Your variable options (VAS file, OdsValAlloc, GlobalDim) depend on your DIAdem version, but the general approach is the same. You need a global DIAdem array variable declared in your VBScript, then you can fill that same global DIAdem array variable in the SUDialog and read the results afterwards in your VBScript. For the OdsValAlloc and GlobalDim array variables you would be able to resize the array in the SUDialog as well, but if you do so with the GlobalDim array variable make sure to use the "Preserve" option, as in:
ReDim Preserve VarName(31)
Ask if you need more info,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
01-11-2007 05:18 AM
Hi,
I have a problem resizing a global array variable, when i resize the array, the values that i assigned before are lost.
The following code demonstrates it
Dim H : H = 0
Globaldim "iArray"
Globalredim "iArray("&H&")"
iArray(0) = 0
msgbox iArray(0) 'You see the value "0" in the messagebox
H = 1
Globalredim "iArray("&H&")" 'Can not use keyword "Preserve"
iArray(1) = 1
msgbox iArray(0) 'The content is lost !!!! no values shown
msgbox iArray(1) 'The value '1' appears on messagebox
Thanks in advance
Kaan
01-11-2007 06:34 AM
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
01-11-2007 06:42 AM
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
01-11-2007 07:37 AM
01-16-2007 08:26 AM
01-17-2007 09:07 AM
Hi Kaan,
How did you declare that array? Did it resize once before, or never? In general you should always declare an array as a scaler, then resize it to an array when you need it, this gives you the most flexibility to resize it again later:
GlobalDim "ArrayVar"
GlobalReDim "ArrayVar(5)"
ArrayVar(3) = "Foo"
GlobalReDim "Preserve ArrayVar(10)"
ArrayVar(10) = "Foo2"
Brad Turpin
DIAdem Product Support Engineer
National Instruments