NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand 2016 SP1 Sequence Templates

Solved!
Go to solution

I am using sequence templates in my example sequences so that users can drag and drop pre-configured functions. The issue is that those sequence templates contain subsequences. Is there a way to auto-include the subsequence as well when a user drags in a parent sequence?

0 Kudos
Message 1 of 7
(3,023 Views)

Hi rdecarre11,

 

There isn't a way to automatically include all of those subsequences when you place the template for your main sequence that I know of. You could however create a Folder under Sequences for each of your main sequence templates that would group the top level sequence as well as the subsequences it calls that way the user could easily select them all and know they have included everything necessary.

Templates.png

 

 

 

Hope this help!

Tyler C.
Technical Support Engineering
National Instruments
0 Kudos
Message 2 of 7
(2,990 Views)

Hey Robert,

I'm investigating a workaround for you. I'll get back to you if I can get something to work. 

0 Kudos
Message 3 of 7
(2,985 Views)

That is what I did at first. Then I decided to put all those sequences/subseqs into another sequence file. I then configured a sequence call step and put that in a folder under the "Steps" folder. The user need only include that sequencefile in their environment and then they drag and drop a step, configured to call the sequence. Feels like it makes more sense in this case as a step template.

0 Kudos
Message 4 of 7
(2,984 Views)

Nice, let me know if you find something!

0 Kudos
Message 5 of 7
(2,981 Views)
Solution
Accepted by topic author rdecarre11

Hey Robert, 

 

You can use the TestStand API to programmatically read in the templates file, which is just a sequence file, then populate your current sequence file with those sequences. My templates file had two subsequences, Seq0 and Seq1, so my code looks like the following: 

 

//Locals.File, Locals.Seq0 and Locals.Seq1 are object references used to store the temp file object reference, and the two sequence references. 
//Locals.userCancelled is a boolean
//The option of 1, the last parameter, is a workaround in this case and should not be used outside of this scenario. It bypasses the check we have for having multiple instances of the same file open.
Locals.File = RunState.Engine.ReadPropertyObjectFile("C:\\ProgramData\\National Instruments\\TestStand 2017 (64-bit)\\Cfg\\Templates.ini", Locals.userCancelled,ConflictHandler_Prompt,1), #NoValidation(Locals.Seq0 = Locals.File.Data.Root["Sequences"]["Seq0"].AsPropertyObject.Clone("",0)), #NoValidation(Locals.Seq1 = Locals.File.Data.Root["Sequences"]["Seq1"].AsPropertyObject.Clone("",0))
RunState.SequenceFile.InsertSequenceEx(1,Locals.Seq0),RunState.SequenceFile.InsertSequenceEx(2,Locals.Seq1)

Then use the InsertSequenceEx() method to add the two object references to the current sequence context. Few caveats to this - the sequence file names are hard-coded, and that may be less than ideal. You would also have to ensure that code modules and types are all available (but this is true for templates, regardless). Ultimately, you can add a tools menu item that would run this and automatically add it to the sequence file you want your user to work with - this would be the easiest workflow for your consumers.

 

Let me know if you have questions on this. 

 

 

 

0 Kudos
Message 6 of 7
(2,945 Views)

Right now I just created another sequencefile in our framework repo and have the templates as steps, instead of sequences. The solution you provided is a bit more complicated, but would certainly work for other situations though, thanks.

0 Kudos
Message 7 of 7
(2,910 Views)