10-28-2013 11:25 AM
Hi,
I followed carefully the example dialog box for Selecting Data Channels at:-
http://zone.ni.com/reference/en-XX/help/370858K-01/procauto/procauto/procauto_channelselect/
When I attempt to run the script calling the dialog box it returns an error message of "Type Mismatch" in the first line of script which is: Call GlobalDim("MyChn()").
The variable MyChn is used in two ChnComboBoxes in the dialog box and is setup to be of type Variant. I have rechecked my work against the example, but I cannot see what is wrong. Using Edit Variables in the SUD editor shows:-
Name--> MyChn
Type--> variant
Storage mode--> unknown
In use--> x
Any help is appreciated. Thanks
10-29-2013 10:34 AM
Hi mrme,
That GlobalDim line of code runs fine in my DIAdem 2012-- what version of DIAdem are you using?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
10-29-2013 11:09 AM
Hi Brad,
Thanks for the support. My version is also 2012. Today, I have seen that the problem has nothing to do with the SUD, but just the declaration of the global array. The following works (or appears to work, without any dim statement):-
Globalredim "Preserve ChnArrX(20)"
The real problem is my lack of understanding of how a global variable should be declared. I thought I should first use dim. and only then redim......What is the correct way to declare a dynamic global array ?
Thanks again
10-29-2013 01:42 PM
Hi mrme,
You can use GlobalDim first followed by GlobalReDim, or you can start right away with GlobalReDim, just like with Dim and ReDim in VBScript. If you put an array size in the GlobalDim call, then you create a static array, otherwise everything else creates a dynamic array.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
10-30-2013 11:17 AM
Hello Brad,
Thanks for the fast responses - it is working now