DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use data in Dialog Box

Solved!
Go to solution

Hello,

 

I am beginning to Use DIAdem Dialog Editor and I am wondering how I would use data that has been input in a dialog box or table cell perform some calculation on it and them display the results in another dialog box.

 

I would also be looking to grab data from a combo box or dialog box and and have it displayed in my final report format.

 

 

Tim
0 Kudos
Message 1 of 21
(8,263 Views)

Hello smoothdurban,

 

Have you had a look at the examples included in the DIAdem Help system yet?

 

There is a pretty nice collection of application examples, including all the source code, in the help system:

 

User dialogs.png

 

When you click on an example, it will have a number of green links, which you can open in the DIAdem Script or dialog editor (depending on the file type) by holding the "Ctrl" key and then left clicking with the mouse ...

 

Let me know if that helps, and ask if you have more specific questions,

 

      Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 21
(8,258 Views)

Hey Otmar thanks for the tip.  However it appears the first half dozen or so examples reference show "SudExample 1.sud as the dialog box file but these are not the same as the example nor do the show any event handling.  I am beginning to use this tool and I am simply looking for how to capture data from text boxes or tables and process the data and display the results

 

I have attached a copy of my .sud file the column labeled  Requested Torque has values which are currently defaulted to 200, 400, 600, 800, 1000,  I wand to take these values multiplying them by the scaling factor and populate the results to the Measured torque table.  The should occur when the calculate button is clicked.

 

The next step would be to grab say data from the combo box and pop it into my script that would call Dialog Box.

 

The attached files extension would need to be changed from jpg to sud.

Tim
0 Kudos
Message 3 of 21
(8,241 Views)

Hi smoothdurban,

 

Here is a quick example of the beginning of what you want to do. It gets data fromthe table modifies it and puts it into another table:

 

Dialog_table.png

Dialog_table code.pngDialog_table_After.png

 

I hope that this helps.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
Message 4 of 21
(8,231 Views)

That helps a lot!  Thanks for your example.

 

How would you handle instances where the value in the table is not a number?

 

For example I have a column of 10 cells that are all to be multiplied by a variable value in a text box.  I would first need to specify that the value in the text box is infact a number by casting it using INT().

 

The problem I have found in doing this is when I use a floating type value such as 1.5 casting the text box into INT rounds the number off.

 

To work around this I have cast the number using ROUND(num, 9).  which gives me more then enough decimal places to work with.  However the values inside column cells may all not have a numeric value and I need to determine a way that I can check whether or not these values are numeric.

 

I tried using the IsNumeric() function but it reckognizes all the values in the column are Strings and thus non numeric.

 

Kind of stuck at this point.

Tim
0 Kudos
Message 5 of 21
(8,215 Views)

Hey

 

I was able to figure this out.  If I check whether or not the cell location is equal to zero space.

 

the code looks like this

 

IF currentCell.Cells(i, 1).Value <> Space(0) THEN

 

 grab the value.

 

 

The only other problem I have run into is how do I check whether or not the data input into the cell is numeric.  Can I limit the iput to numberic values exclusively?

 

Also

 

Does anyone know how to open up a file broser in the Dialog box?

 

I basically what to give the user the ability to grab the file location in the Dialog box which would inturn pass this to DIAdem as the location of the file to open.

 

Any thoughts?

Tim
0 Kudos
Message 6 of 21
(8,212 Views)

Hi smoothdurban,

 

I'm not sure if it's the best way to limit input information to numeric entries only, but one way that would work is to use the following line of code in the Event handler for the OnItemChange() method:

 

Sub Table1_OnItemChange(ByRef This, Row,Col) 'Created Event Handler
  IF NOT IsNumeric(This.Cells(Row,Col).Value) THEN This.Cells(Row,Col).Value = 0
End Sub

 

When a cell value changes, this would run and check whether or not the entry is numeric.  If it isn't then the cell value would be reset to 0.

 

As far as launching a file selection dialog box, I recommend the following two functions:

 

FileNameGet()

... if you're asking the user to load a DIAdem file (data, layouts, scripts, etc)

 

FileDlgShow()

... if you're asking the user to select a generic file.

 

Let us know if you have additional questions.

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 7 of 21
(8,201 Views)

Thanks for the tips.  I have been able to use your hints to navigate and select the file I want to process.

 

I did have another question.

 

I have developed a dialog box which takes certain user input and I would like to pass the user input into another VBScript file.

 

This is the process that I currently have.

 

My main VBScript file is run and calls SUDD1gShow( ).  I would assume the main script file waits until the SUDD file has completed its execution.

 

I want to take the user input acquired in the SUDD file and pass it to the original VBScript file that called it when a event occurs on the SUDD file such as a button being pressed.

 

ANy ideas on how pass reference to another program? 

Tim
0 Kudos
Message 8 of 21
(8,196 Views)

Anybody have any ides? 

 

I am basically trying to return some values to my original script file once my SUD file has executed and closed.

 

To simplify it even further I am trying to return data generated by one object to another. 

 

 

 

 

Tim
0 Kudos
Message 9 of 21
(8,181 Views)

Hi smoothdurban,

 

One way you can transfer information back and forth is to use global variables. If you take a look at the example "Dynamic User Dialog Box" you will see that the "iMyVar2" variable is used on the initial script and the script on the back side of the dialog box.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
0 Kudos
Message 10 of 21
(8,175 Views)