DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create STP-File for loading ASCII files without fixed channel length?

Hi!

Problem:

I need to load ASCII-files by using a script and a previously once created STP-Confi file in it (this file was created by loading one of the ASCII-files and save the configured STP-File). At the end I have two different ASCII-files and for each an own STP-file. But one of this STP-files load each time the same channel length of the ASCII-file, even if there are more values in it. The other STP-file for the other ASCII-file works good and load always the right channel length of ASCII-File. I couldn't find any setting to limit or fix the channel length by creating the STP-file.

How I can make sure, that the ASCII-files will be load always with full channel length?

 

Regards

 

Sven

0 Kudos
Message 1 of 10
(6,153 Views)

Hi Sven,

 

As far as I know, there is nothing in the STP file that limits the row length of a data channel arranged as a column of values.  If your data channel happens to be stored all in the same row in the ASCII file, then I could understand this better.  One of the biggest problems with the old ASCII Import Wizard was that it declared a static number of columns/channels and would ignore extra columns in another ASCII file that happened to have more columns than the one you created the STP file with.

 

Are you able to post the ASCII data file and the STP file for us to look at?

 

What version of DIAdem are you using?  Since DIAdem 9.1 we've had a superior data import option for ASCII files in the DataPlugins.  It would probably be better and easier for me to help you create a DataPlugin for your ASCII files, as long as you're not using DIAdem 9.0 or before.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 10
(6,146 Views)

Hi Brad,

 

attached you can find 2 files. First one contains: 

CA_RG.LTR is the ASCII-file I want to load

Test_01.STP is the stp-file, created by

- File/Open...

- choosing "ASCII-Import (*.*;*.csv;*.asc;*.txt;*.dat)" as file type in the dialog

- settings in ASCII-Import Assistant: only ignore first two lines, everything else remains as standard/preset

- save configuration as Test_01.STP

 

When you open the STP-file in editor, in line 18 pos. 14 you'll find string "(666)". This is clearly the channel length for the data area to load. When you change that value to e.g. "(12)", only 12 lines will be loaded from the ASCII-file. If you change that value to "(0)", all lines in the ASCII-file will be loaded. So that could be a way to solve the problem, even if I dont know, how it could be caused.

 

The other 2 files show the other situation:

MTS.TAB is the ASCII-file to load, Test_02.STP is the belonging STP-file, created by the same way as described above (only difference: ignore first 117 lines). But this STP-file obviously contains no information about channel length (672 in this TAB-file). But there is: in line 18 pos. 18 you cann see the string "(113)". Because there are exactly 113 channels in MTS.TAB, of course it seems, that this entry tells the number of channels. But if you edit this entry e.g. to "(110)", all 113 channels will be loaded but only with 110 lines!! This is realy strange for me and it makes it not sure to load always the right content of ASCII-files by using an automated script. There should be an easy way to make especially channel length and possibly channel number free for using a config file for loading sort of ASCII-file.

 

Regards

 

Sven

 

Download All
0 Kudos
Message 3 of 10
(6,125 Views)

Hi Sven,

 

I have reviewed the files you posted, and if you will please confirm that you have DIAdem 9.1 or later, I will happily create 2 DataPlugins for you-- one for each of the file formats you posted.  If on the other hand you happen to be using DIAdem 9.0 or earlier, I will have to look more deeply into the nicely detailed information you have provided on your current STP approach-- in this case I can not guarantee success, but I will pledge to try.

 

Awaiting your response,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

 

0 Kudos
Message 4 of 10
(6,117 Views)

Sorry Brad!

 

I'm using DIAdem 11.0 ! I remember you told, that there is possibly another possibility to load ASCII datas?

 

Another problem occurs:

How can I execute a real VBS command line in a DIAdem script without occuring errors caused by DIAdem command interpretations?

Here is the current command line I try to include, but probably DIAdem hangs at the := .

 

Workbooks.OpenText filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:="."

 

Using other writings as

 

Workbooks.OpenText(filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:=".")Workbooks.OpenText filname, "DataType:=xlDelimited", "tab:=True", "DecimalSeparator:=','", "ThousandsSeparator:='.'"

 

don't help, I always get error messages.

I'll post this problem in another message as well, but if you have any idea to solve it, I would be happy to here from you.

 

Regards

 

Sven 

 

 

 

 

 

 

0 Kudos
Message 5 of 10
(6,105 Views)

Hi Sven,

 

OK, I'll look into creating DataPlugins for you tomorrow when I get back into the office after our Memorial Day holiday here in the US.  But the two Workbooks methods you posted below have very strange syntax.  It looks like you just need to surround each string constant parameter with double quotes in order to satisfy VBScript syntax, though you also need to use double-double-quotes insided the string constant whenever you need a double quote character (ASC=34).

 

Workbooks.OpenText filname, "DataType:=xlDelimited", "tab:=True", "DecimalSeparator:="",""", "ThousandsSeparator:=""."""

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 10
(6,097 Views)

Hi Sven,

 

I wrote a DataPlugin for both the *.LTR file format and the *.TAB file format that you posted.  Just detach the ZIP file, unzip it, then double-click on each *.URI file in turn from Windows Explorer.  After that you should be able to drag&drop these files from the NAVIGATOR into the Data Portal.

 

Let me know if you have questions or issues,

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 7 of 10
(6,082 Views)

Hello Brad,

 

thanks for your help! It seems that the plug ins are working fine. But at least for my current work I need to load ASCII-Files from two different measuring systems: 1st delivers the TAB-File, the plug in works; 2nd delivers at least 15 files with about the same structure, but different file extensions (one even has no extension!). The plug in of course works now only for the LTR-file. Could you modify it to work with all the 15 files (see attached zip)?

Of course it's extremely helpfull to have these plug ins for work with the navigator. But I need to include something to load these files automatically via script (as currently doing with the STP-file). Do you see a possibility for that too?

 

Regards

 

Sven

0 Kudos
Message 8 of 10
(6,061 Views)

Brad, of course you need the ASCII-files 🙂

See this attachment.

 

 

0 Kudos
Message 9 of 10
(6,060 Views)

Hi Sven,


You can add the extra file extensions to the Sventtke_LTR DataPlugin's file extesion list yourself by changing its configuration in the "DataPlugin Settings" dialog.  You can find this dialog by starting in either the NAVIGATOR or SCRIPT panel and then selecting the menu, "Settings >> Options >> Extensions >> DataPlugins..". Now double-click on the Sventtke_LTR DataPlugin to reach its configuration dialog, and change the "File extensions" field to:

 

*.LTR; *.XYZ; *.PAR; *.DCA; *.DCR; *.BCE

 

This will enable all these file types to load automatically with the Sventtke_LTR DataPlugin-- for instance via drag&drop from the NAVIGATOR.  There is no way inDIAdem 11.1 or earlier versions to assign an empty file extension to a DataPlugins' file extension list.  In order to interactively load the files with no file extension, you will need to right-click on the file in the NAVIGATOR and select the "Open with..." context menu, then select the Sventtke_LTR DataPlugin.

 

But if you're loading these data files programmatically, the following command will work for all these file types that should be loaded with the Sventtke_LTR DataPlugin:

 

Call DataFileLoad(FilePath, "Sventtke_LTR")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 10 of 10
(6,051 Views)