DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Load .A01, .A02, .A03.... Files into DIAdem

Solved!
Go to solution

I am trying to write a script to allow a user to create a data set by loading a series of ASCII files.  The files have .A01, .A02, .A03, etc. file extensions.  I can manually load these files individually, but can't seem to get them to load via program coding.  The code below is what I was attempting to use to load one of the files, however DIAdem 11.0 running on a Windows 7 machine will just shut down and DIAdem 10.0 running on a Windows XP machine will appear to run the script...but with no data actually loaded to the data portal.

 

Call MSGBOXDISP("Please Select First Data File")
Call FILENAMEGET("DATA", "FileRead")
    If DLGSTATE="IDOk" Then
        DATADRVUSER=FILEDLGDIR
        Call ASCIIConfigLoad("C:\Users\wi3083\Desktop\BH-OB29\RoughRoad ASCII Import.STP")
        Call ASCIILoad(DATADRVUSER & FILEDLGFILE, 0)
    End If

 

Another option I have tried is:

 

Call MSGBOXDISP("Please Select First Data File")
Call FILENAMEGET("DATA", "FileRead")
  If DLGSTATE="IDOk" Then
    DATADRVUSER=FILEDLGDIR
    Call ASCIIAssocSet(".A01","C:\Documents and Settings\administrator\Desktop\BH-OB29\RoughRoad ASCII Import.STP")
    Call ASCIILoad(DATADRVUSER & FILEDLGFILE,0)
    Call ASCIIAssocDel(".A01")
  End If

 

Any ideas would be appreciated!

0 Kudos
Message 1 of 8
(5,116 Views)

Hi CrshTstr,

 

If we are referencing a configuration file when loading ASCII files, the following commands should ensure you do not open the ASCII Import Wizard:

 

Call ASCIIConfigLoad(ConfReadPath & "ConfFile.stp")

Call ASCIILoad(DataReadPath & "DataFile. A01",0)

 

I tried implementing these commands in a DIAdem 11.0 script file on a Windows 7 machine and was able to successfully load the information onto the data portal. Have you verified that the extensions are consistent between the saved file and the script commands? If so, have you been able to replicate this behavior using just the two calls to load ASCII data?

Best Regards,
Swathi B
0 Kudos
Message 2 of 8
(5,077 Views)

Hi CrshTstr,

 

I would  strongly advise you to create and use a DataPlugin instead of the ASCII Import Wizard.  DIAdem 10.1 gives you the option at the end of the ASCII Import Wizard to create a DataPlugin instead of an *.stp file.

 

Care to post or send any of those data files?

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 8
(5,057 Views)
I'm not real familiar with DataPlugins.  Here's a few of the data channels.  The data for each channel is contained in a separate file.  Thanks for your help!
0 Kudos
Message 4 of 8
(5,054 Views)
Solution
Accepted by CrshTstr

Hi CrshTstr,

 

I'm attaching a DataPlugin I wrote for your submitted 23 data files.  You just need to detach the *.URI file and double-click it with Windows Explorer to register the DataPlugin with your computer.  Then you can run this sort of code to call it:

 

Call DataDelAll

FilePath = "C:\NICS\Discussion Forum\CrshTstr\BH-OB29\BH-OB29AS.A"

FOR i = 1 TO 23

  n = Right("00" & i, 2)

  IF i = 1 THEN Call DataFileLoad(FilePath & n, "CrshTstr")

  IF i > 1 THEN Call DataFileLoadSel(FilePath & n, "CrshTstr", "[1]/[1]")

NEXT ' i

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 5 of 8
(5,030 Views)

That worked great!  Thanks, Brad.  I made a little modification, so that the user can select the group of data files to be loaded.  The other thing I would like to do is allow for varying numbers of channels...rather than fixing it at 23 as in my example set.  I'm not sure if there's an easy way to add this type of addjustabilty to the current script.

 

Call DataDelAll
Call MsgBoxDisp("Please Select First ASCII Data File")
Call FileNameGet("DATA", "FileRead", , "CrshTstr")

If DlgState = "IDOk" Then
  DataDrvUser = FileDlgName
  FilePathLen = Len(DataDrvUser)
  FilePathShort = FilePathLen - 3
  FilePath = Left (DataDrvUser, FilePathShort)

  FOR i = 1 TO 23
    n = Right("00" & i, 2)
    IF i = 1 THEN Call DataFileLoad(FilePath & n, "CrshTstr")
    IF i > 1 THEN Call DataFileLoadSel(FilePath & n, "CrshTstr", "[1]/[1]")
  NEXT ' i

Message Edited by CrshTstr on 05-26-2010 03:52 PM
0 Kudos
Message 6 of 8
(5,021 Views)

This might not be the most elegant solution to the varying number of data channels issue, but it works as long as I never have more than 100 channels: 

 

FOR i = 1 TO 100
    n = Right("00" & i, 2)
    IF i = 1 THEN Call DataFileLoad(FilePath & n, "CrshTstr")
    IF i > 1 THEN Call DataFileLoadSel(FilePath & n, "CrshTstr", "[1]/[1]")
    On Error Resume Next
  NEXT ' i
    On Error GoTo 0

Message Edited by CrshTstr on 05-27-2010 10:37 AM
0 Kudos
Message 7 of 8
(4,990 Views)

CrshTstr,

 

The other option you could use would be the FildDlgShow command.  Here's the prototype for the function: FileDlgShow(FileDlgName, [FileDlgFilt], [FileDlgCaption], [FileDlgMultiSelect])

 

The reason I recommend this is if you pass in a True value for the FileDlgMultiSelect parameter it allows you to select multiple files with in the dialog (via shift+click or ctrl+click).  The function returns to you a list of files selected (FileDlgNameList) and you can easily loop through those list items and load all the files as seen in the example below:

 

Dim iCount

Call FileDlgShow(DataReadPath, "TDM Files,*.tdm|DAT Files,*.dat|Excel Files, *.csv;*.xls", "Data selection", True)

For iCount = 0 To Ubound(FileDlgNameList)

      Call DataFileLoad(FileDlgNameList(iCount))

Next

John B.
Applications Engineer
National Instruments
Message 8 of 8
(4,976 Views)