DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ExcelImport and STP question

I am trying to programatically import data from an Excel file.  The Excel file is a record of measurements that is appended to each day.  Consequently, the file grows in length (number of rows) until a certain point where it begins again. 
 
Before trying to load programatically, I loaded the Excel file manually and saved a STP configuration file.  The problem I am experiencing relates to the length of the file.  When I programatically load the file using
 
Call ExcelImport(Filter_Weights_Path & Filter_Weights_File, "Sheet1", 0, AutoActPath & "FilterXferToMTL_2.STP")
 
the file does not completely load.  However, if I manually load the file (through NAVIGATOR, File -> Open -> ...etc.) using the same STP file, all data is loaded properly.  I can also use
 
Call DATAFILELOAD(Filter_Weights_Path & Filter_Weights_File,"Excel","Load")
 
and the Excel Import Wizard dialogue box comes up and I simply need to click "finish" but I would prefer to run this completely programatically. 
 
My main question/problem is I need to be able to load all rows of this Excel file with the configuration I have set up and I am not sure if the ExcelImport method is the correct way to do this.  I have attached my script, the STP file and an example of the Excel file.  Any help would be appreciated.
 
Thank you!
Julia Moeller
0 Kudos
Message 1 of 18
(4,604 Views)

Hi Julia,

 

I found the following things:

You don’t import the first headline – maybe it is not important but you can choose “B3” instead of “B4” in STP file.

 

The bigger problem is that you try to import channels with the same channel names like 7277 or 7307 or 7322 etc.. In DIAdem it is standard to have unique channel names within a channel group. So the default is that DIAdem makes double channel names unique by counting up the last imported name. Example: the first loaded channel is named ABCData than you try to import a second channel with the same name. DIAdem loads this channel and rename it to ABCData1 - so far so good. But in your special case your channel names are already numbers, so in case of double channel names DIAdem is counting up the number (7277 will be 7278). In your special case that could make some trouble. The solution for that problem is a separator between original channel name and the number. That is supported since DIAdem 9.1 SP2. (The latest service packs you find on: www.ni.com/support/diasupp)

Information from the SP2 Readme:

For unique channel names in the channel group, you can now specify your own separator. You use the UniqueNameSep variable to specify the separator. The variable can accept the following values: "None", "Underscore", "Dot", "Colon", "Semicolon", "Plus", "Minus", "Space".

Example: You create three channels called "Result" in a channel group. The following assignment results in the channel names shown: UniqueNameSep = "Underscore" => Result, Result _1 and Result _2.



I’ve added the command UNIQUENAMESEP    ="Underscore" to your script and as far as I could verify all data are loaded  now.

I hope this will solve the problem.

 

Greetings

Walter

0 Kudos
Message 2 of 18
(4,590 Views)
Thank you for your help Walter, I did not know about the niqueNameSep command and think I will use that in the future.  However, I am still having problems.  My script continues to only load data until line 358 of the excel file or Filter ID # 2890.  I am perplexed! 
0 Kudos
Message 3 of 18
(4,588 Views)
Hi Julia,

I've tested it again and it seems to work fine. The last channel name is 3602. Are you working with DIAdem 9.1 SP2 ?

If not please install the latest service pack from our web page (www.ni.com/support/diasupp) and try again.

Greetings

Walter
0 Kudos
Message 4 of 18
(4,582 Views)

Yes, I believe I have SP2.  When I go to Help -> About DIAdem -> I get:

DIAdem: 9.10.2260 TDM Service Pack 1

USI: 1.1.1.2254

0 Kudos
Message 5 of 18
(4,580 Views)
Hi Julia,
 
Since it looks like you actually have Service Pack 1, I would suggest installing Service Pack 2 to see if it may fix the problem.  You can get Service Pack 2 at www.ni.com/support/diasupp
 
Hope this helps,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 6 of 18
(4,565 Views)
I'm sorry, I meant to type "2" there...not sure why did that. 
0 Kudos
Message 7 of 18
(4,564 Views)
Hi Julia,

I would like you to test the attached script. With that I can load all 445 channels from the Excel file.
If this doesn't work perfect please, send me your Desktop.DDD file.

Greetings

Walter


0 Kudos
Message 8 of 18
(4,553 Views)

Hello Walter,

Yes, that script does load everything properly.  However, it uses the DataFileLoad (line 25) method rather than the ExcelImport method so the Excel Import Wizard dialog box comes up, something I would prefer to avoid.  Am I missing something?

Thank you again!  Julia

0 Kudos
Message 9 of 18
(4,546 Views)
Hi Julia,

I'm very sorry. I've zipped the wrong file. Please try this here:

Greetings

Walter
0 Kudos
Message 10 of 18
(4,543 Views)