From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Sequence File Name ?

Hello everybody !!


I'm using TestStand 3.1 and i would like to get sequence file name. I've tried to use NameOf() function, but without success.
Of course, I've searched previous posts about the same question, but nothing works.

Is there someone able to tell me how to get sequence file name ?


Thanks a lot.


MrOrange
0 Kudos
Message 1 of 9
(9,831 Views)
MrOrange,
 
first of all, the solution i will present only works for saved sequence files.
you got all information you need within TestStand itself, just browse for RunState.SequenceFile.Path. here you can find the filename. but the path of the file is also included in the string, so this is a part you have to get rid off.
you can use statements to extract the filename from the path. just search the string for the last occurence of "\\" (searchinreverse!) and then you can retrieve the right() part of the path. beware that right() needs the number of characters you want to extract, not the startindex!!
 
hope this helps,
Norbert B.
NI Germany
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(9,825 Views)

Hi,

If you looking for the Sequence File name in general, use RunState.SequenceFile.Path, this gives the full path therefore you would have to strip off the path from the filename

If you are looking for the sequence file linked to a SequenceCall step, use Step.TS.SData.SFPath, and this may contain an absolute pathname.

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
Message 3 of 9
(9,825 Views)
Thank you for your answers.

In fact, I thought that it existed an easier way to get this information.

A have nice day.
0 Kudos
Message 4 of 9
(9,820 Views)
Hello,

i have the same problem. How can i solve it? Ok i can get the path of the file and then i want to have only the file name.

For example: c:\hello\1234.seq = filename "1234"  or c:\hello\test1234.seq = filename "test123"

The name has not the same size at all times. Can someone send me an example expression that stores only the filename in a variable.

Thankyou schwede
0 Kudos
Message 5 of 9
(9,678 Views)
Hi,
 
If you are staying in TestStand, then use the Search function to search your path string for the character "\ " using the option to search starting from the right instead of the left. This will give you an start index to point to the start of your filename. You can do a similar action to find the end of the filename by searching for the ".". Then use the string MID function to extract your filename from the path string.
 
Hope this helps
Ray Farmer
Regards
Ray Farmer
Message 6 of 9
(9,672 Views)
Thankyou thats`s it:

StationGlobals.Fielname= Mid(RunState.ProcessModelClient.Path,Find( RunState.ProcessModelClient.Path, "\\", 0, true, true)+1,(Find(RunState.ProcessModelClient.Path,".",Find( RunState.ProcessModelClient.Path, "\\", 0, true, true),true,false))-Find( RunState.ProcessModelClient.Path, "\\", 0, true, true)-1)


greetings schwede
0 Kudos
Message 7 of 9
(9,667 Views)

Split((Split(RunState.SequenceFile.Path,"\\")[(GetNumElements(Split(RunState.SequenceFile.Path,"\\"))-1)]),".")[0]

 

Splits path by backslash, and then pick the last element of the array, and then splits by . and then picks the first item which is the filename.

Message 8 of 9
(8,236 Views)

Let us assume you are running the sequence file "TestStand_Sequence.seq" located at "C:\TS_Scripts"

 

"RunState.SequenceFile.Path" - Returns the absolute path of the script
i.e "C:\TS_Scripts\TestStand_Sequence.seq"

"Left(RunState.SequenceFile.Path, Find(RunState.SequenceFile.Path, "\\", 0, False, True))" - Returns the File Location
i.e "C:\TS_Scripts"

 

"Right(RunState.SequenceFile.Path, (Len(RunState.SequenceFile.Path) - Find(RunState.SequenceFile.Path, "\\", 0, False, True) - 1))" - Returns the File Name
i.e "TestStand_Sequence.seq"

 

Note: These are RunState components. Hence available only during runtime

Message 9 of 9
(7,440 Views)