DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Dialog box example - Global Variables -> type mismatch

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

 

 

 

0 Kudos
Message 1 of 5
(6,653 Views)

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

0 Kudos
Message 2 of 5
(6,630 Views)

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

0 Kudos
Message 3 of 5
(6,623 Views)

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

0 Kudos
Message 4 of 5
(6,618 Views)

Hello Brad,

 

Thanks for the fast responses - it is working now

 

 

0 Kudos
Message 5 of 5
(6,601 Views)