DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use data in Dialog Box

Solved!
Go to solution

Hi smoothdurban,

 

What's the bigger picture here?  What are you trying to do, at a high-level?  There may be a better way to approach this.

 

That said, to directly answer your question, you can store information from a dialog within DIAdem's pre-allocated Auxiliary Variables (T1, R1, etc.), or you could always globally allocate your own variables, which then be programmatically accessible to DIAdem after your dialog box returns.

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 11 of 21
(2,853 Views)

Hey Derrick

 

I am trying to use a GUI to allow a user to select which data file to process and generate a report.

 

I currently have a VBScript file and Report Layout which conditions test data and creates test channels and generates the desirable report layout.

 

I want to add a GUI which would allow a user to select individual files to process and and add some pertinent test information.   

 

Seems Simple enough.

Tim
0 Kudos
Message 12 of 21
(2,851 Views)

Hi smoothdurban,

 

If you're just looking to prompt the user to choose which files to process, note that can be done from SCRIPT without involving a custom user dialog box (using the commands we spoke about earlier in this thread).  If you choose to call the commands from your user dialog box, the selected files will still automatically be available as DIAdem environment variables that are accessible from your "main" script.

 

If you need to have the user enter additional information (for example, operator name), then a custom user dialog box seems like the way to go.  However, in the most ideal case, this type of information could be added to the data collection application and saved to the actual data file(s) so that the information would not only automatically populate in your reports, but would also be searchable using DataFinder (e.g. find all files where the operator name was "George").

 

If you choose to go the custom dialog route, then using the variable approach to access the "additional information" from your primary script will work great.  

 

 

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 13 of 21
(2,848 Views)

I have been able to use the code provided in the thread to give the user the ability to select which file they would like to process and then process it.

 

I would like to add a custom dialog box which would take in such things as operator name, test title etc.  The operator names could come from a combo box while the test name would be manually entered.

 

How would I be able to grab this information in the dialog box and send it to my VBScript.

 

 I tried looking at the example Dynamic User Dialog Box but for some reason my version of DIAdem has different SUD file listed as "SudExample 1.sud"  which does not appear to correspond to the VBScript Sud SignalSelect.vbs.

 

However I do see how the global variable has been declared.  How would I reference a global variable called in one script in another script?  (An example of how do to this would be appriciated!)

Tim
0 Kudos
Message 14 of 21
(2,838 Views)

Hi smoothdurban,

 

The example that I mentioned shows how to do this. Once the variable is declared it is referenced like any other variable. If you could not clearly view the code, here is a snippet:

 

Call GlobalDim("iMyVar1, iMyVar2")

iMyVar1 = 1
iMyVar2 = 0

 Here is the help file that discusses Global Variables in DIAdem:

 

http://zone.ni.com/reference/en-XX/help/370859H-01/comoff/globaldim/

 

I hope that this helps.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
0 Kudos
Message 15 of 21
(2,831 Views)

Hey Perry,

 

Any experience using global variable in an array? 

 

It seems I get errors when I try to do so.

Tim
0 Kudos
Message 16 of 21
(2,791 Views)

Hi Tim

What are your problems? What is your code and the what are the error messages? As explained in the help (http://zone.ni.com/reference/en-XX/help/370859K-01/comoff/globaldim/) you can use arrays in GlobalDim.

 

Winfried

0 Kudos
Message 17 of 21
(2,789 Views)

The problem I am having is that i create a clobale variable array

 

GlobalDim "ArrayTest()"

 

Then I am unsure how to specify the array size which I normally perform with ReDim on local variables. 

 

I am also curious whether or not I could set the size of the global array using my script in one of my SUDialog box scripts?

Tim
0 Kudos
Message 18 of 21
(2,786 Views)
Solution
Accepted by topic author smoothdurban

The best way is to use it in conjunction with GlobalRedim. The following example shows you haw to use it

Call ScriptCmdReset
GlobalDim "ArrayTest()"
GlobalReDim "ArrayTest(3)"

arraytest(1) = 5
call test

sub test
msgbox Arraytest(1)
End Sub

 To reset all global Variables use ScriptCmdReset

 

Hope this helps

Winfried

0 Kudos
Message 19 of 21
(2,784 Views)

Thanks

 

Needed to Call ScriptCmdReset.

Tim
0 Kudos
Message 20 of 21
(2,781 Views)