DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i let the user tell me what data file they want to use and how do i manipulize that variable in autosequence?

i would like to use a drop down box in diadem to let the user browse for the data file they want to import, but if this is not possible then i could use a message box or just a user imput box.
0 Kudos
Message 1 of 6
(5,814 Views)
Hi,

There are several ways to do this, the easiest one is this one:

Call FileNameGet("DATA","FileRead")
Call DATALOAD(FileDlgFile)

The command FileNameGet will open a standard windows file dialog, in this example only two parameters are required. The "DATA" parameter indicates that the software will load a data files, not a layout or an Autosequence or something like this. The "FileRead" parameter tells DIAdem that the file name entered or selected in the dialog will be used to load(read) the file, not to save(write) it.

DATALOAD is the command that tells DIAdem to load a data file, the parameter is 'FileDlgFile', which is the name of the file selected in the file dialog created by the FileNameGet command.

There is also a way
to open a dialog and have a drop down list with all available file names in that dialog. It is a little more complicated to make these and I don't like it very much because you have no way of easily filtering the files in that list (i.e. if there are 200 data files in a directory, you will have all of them in the list). If you want to know how that works, I can probably make an example for you.

Let me know if this helped,

Otmar
Otmar D. Foehner
0 Kudos
Message 2 of 6
(5,814 Views)
thanks Otmar, but i have obtained that code since i posted the question. i have a problem with it though.. when the if then statement is in there it doesn't open, when it is out it gives me an error "key word "date/time.........." is not included in the key word list. it was talking about the header. so out of curiousity i deleted the header to see if it would make a difference. it gave me the same error and it used a line of actual data as the "not included in the key word list error. any ideas? maybe i need a different command to get data?
0 Kudos
Message 5 of 6
(5,814 Views)
With a little more spice:

Call FileNameGet("DATA","FileRead")
If (DlgState = "IDOk") Then
DataDrvUser = FileDlgDir
Call DataLoad(FileDlgFile)
End If


For more details refer to the knowledge base titled
"Calling the File Open Dialog from DIAdem Autosequence"

Hope this helps

TomF
Message 3 of 6
(5,814 Views)
thanks tom, but i have obtained that code since i posted the question. i have a problem with it though.. when the if then statement is in there it doesn't open, when it is out it gives me an error "key word "date/time.........." is not included in the key word list. it was talking about the header. so out of curiousity i deleted the header to see if it would make a difference. it gave me the same error and it used a line of actual data as the "not included in the key word list error. any ideas? maybe i need a different command to get data?
0 Kudos
Message 4 of 6
(5,814 Views)
Is the data file your opening a DIAdem DAT file or a different type? If it is a DIAdem DAT file can you open up any of the example files? If so then perhaps you can post your file and the header so we can determine what the issues is. Sometimes the header doesn't line up properly and will cause errors.
0 Kudos
Message 6 of 6
(5,814 Views)