NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read a .xls file from a location same as the sequence file without specifying the path?

Solved!
Go to solution

Hi,

 

I am trying to open an existing .xls file from the same location as the test sequence file. Can TestStand search in the test sequence file location for the input file and then select it if present? Also, can the output file be stored in the same location without specifying the path in the code?

 

Example:

Input.xls -> Input file to the test sequence that is to be read.

 

Output.xls -> Output file created by the test sequence.

 

Test.seq -> Test sequence that reads Input.xls and creates Output.xls.

 

If Test.seq and Input.xls are present in D:\Test\ location, can the code Test.seq be modified to pick up Input.xls automatically without specifying the path? Also, can Output.xls be created at D:\Test\ without specifying the path?

 

Thanks,

Sayali

0 Kudos
Message 1 of 6
(3,484 Views)
Solution
Accepted by topic author Sayali

Hi Sayali,

 

Yes this can be done. You can get the path to the current sequence file using RunState.SequenceFile.Path. Then search for and strip off the last '\' using the String functions to get just the path. You can then use this directory path to manage your Input.xls and Output.xls files.

 

-Jack

Message 2 of 6
(3,460 Views)

Hi Sayali,

 

Thanks for your suggestion Jack. Another thing you could do would be to use the FindFile function. So if I was trying to pass the file 'Test.dat' which is saved in the same directory as my sequence and I had a local variable called FilePath I could run this expression:

 

Locals.filefound = FindFile("Test.dat", True,Locals.FilePath)

 

and the full path of Test.dat would be stored in Locals.FilePath.

 

Hope this helps!

Sean Ferguson
Application Engineering Specialist | RF and Reconfigurable Test
Message 3 of 6
(3,438 Views)

Thanks a lot for the suggestion! I will try this one too..

 

Thanks,

Sayali

0 Kudos
Message 4 of 6
(3,416 Views)

Hi Sayali,

 

I'm using the "Property Loader" in the "PreUUTLoop" to load test limits according the model selected. Just before the Property Loader step I have a Message Popup asking for the model to test and in the Post-Expression:

 

Locals.LimitFileToLoad = Left( RunState.SequenceFile.Path, Find( RunState.SequenceFile.Path, "\\", 0, False, True ) ) + ((Step.Result.ButtonHit == 1) ? "\\Limits\\Limits_50k.xls" : " \\Limits\\Limits_100k.xls")

 

The Property Loader use: Locals.LimitFileToLoad   in the file name expression.

 

Mfg. Test Engineer
Certified LabVIEW Associate Developer
0 Kudos
Message 5 of 6
(3,304 Views)

Hi,

 

Thanks a lot for the suggestion. However, I will not be trying this method as we avoid having pop-up messages in our tests.

 

Appreciate your help though!

 

Thanks,

Sayali

 

 

0 Kudos
Message 6 of 6
(3,293 Views)