NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get selected sequence in a file

Hello,

    I can get the selected sequence file by accessing the RunState.InitialiSelection.SelectedFile property. However, if i want to get the name of the sequence that was selected in this sequence file, then how can i get that?

Thanks,
Regards,
Aparna

0 Kudos
Message 1 of 7
(3,852 Views)
Funny that you should ask this. I am trying to figure out the same thing. However, I am curious if you are trying to get the name of the file in Test Stand, or via a OI in Lab View. I am also wondering if you are trying to get the name of the Sequence File, or the name of the Sequence that is currently active in a Sequence File. Here are somethings that I do know:

If you want to get the names of the steps in a sequence you can access them from RunState.SequenceFile.Data.Seq. You can also get the file path of the sequence, which includes the name of the sequence file, from RunState.SequenceFile.Path. Both of these properties are always available. You can also access these same variables in Lab View by utilizing the SequenceFileManager->(Use a property Node)SequenceFile->(Property Node)Path.

If you figure out how to get the name of the sequence file, without using the path variable which requiers parsing just to get the name, let me know!

Thanks,
Chris
0 Kudos
Message 2 of 7
(3,844 Views)
I just re-read your post and realized I thought you were asking for something else. If you want to get the name of the selected sequence simply use RunState.InitialSelection.SelectedSequences. Under RunState.InitialSelection is about everything you could ever want to know about a sequence.
0 Kudos
Message 3 of 7
(3,839 Views)

Chris,

There is a DisplayName property that returns exactly what you need.

From the Help:

DisplayName Property

Syntax

PropertyObjectFile.DisplayName

Data Type

String

Purpose

Specifies the name to display for the file.

Remarks

This property returns the file name portion of the pathname value of the Path property unless you set it to a different value.

Regards.

 

Antonio Lie.

0 Kudos
Message 4 of 7
(3,837 Views)
Awesome! That worked perfectly! Thanks Antonio! Just in case someone is trying to figure out how to do this exactly simply:

SequenceFileViewManager->(PropertyNode)SequenceFile->(PropertyNode)AsPropertyObjectFile->(PropertyNode)DisplayName

Thanks again!
0 Kudos
Message 5 of 7
(3,833 Views)
Hello,

   Sorry, i saw this thread a little late. My question is still the same. The solution that you gave actually gives me the display name of the sequence file. But i wanted the name of the sequence that was opened withtin the sequence file. Here is what i have.

A sequence file named TestExport.seq has two sequences  - MainSequence and SecondSequence. I open up the sequence file and open the SecondSequence in that file. But i dont know how to get this information about the sequence that is selected within the file. I have an external dll, in which i am passing the sequence file name as RunState.InitialSelection.SelectedFile. But i do not know how to get the sequence name that was actually opened in that file. Because i actually want to get the sequence context of the sequence within the file. The code that i have looks like this:

public ExportDlg(SequenceFile seqFile)
{
            InitializeComponent();
            SequenceContext seqContext = seqFile.NewEditContext();
            engine = seqContext.Engine;
            object outParam = System.Type.Missing;
            this.seqContext = engine.NewEditContext(seqFile.GetSequence(0).AsPropertyObject(),System.Type.Missing,out outParam);
}
 
seqFile.GetSequence(0) - gives me the context of the first sequence which is MainSequence. But if i have opened the SecondSequence, i need the context for that. And to get this, i need the sequence name "SecondSequence" somehow.
RunState.InitialState.SelectedSequences is an array of containers. Although i can see the sequence name during executing, i do not know how to get the name of the container my external dll .

Please help,

Thanks,
Regards,
Aparna

          
0 Kudos
Message 6 of 7
(3,810 Views)

Hi,

Use the lookup string "RunState.InitialSelection.SelectedSequences". This is an array of sequences.

To get the name of the a sequence use NameOf(RunState.InitialSelection.SelectedSequences[n]) where n is the index of the array starting from 0.

Hope this helps

Ray Farmer

Regards
Ray Farmer
Message 7 of 7
(3,793 Views)