NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Returning Step Names

Hi,

I am attempting to return Main Sequence Test names in the Main section of the code and ignore any labels, steup and cleanup routine steps in my log. Is there a way to use an expression to do this? I have a current expression that will grab all of the Main Step test names, but will also include labels, setup and cleanup route steps, which I do not need. The expression I am using is RunState.Caller.Main.Step.Name which will grab all of the steps in the Main Sequnce of my interested sequence file.

0 Kudos
Message 1 of 4
(3,566 Views)

When your reference to sequence (If current running sequence, you can easily get with "RunState.Sequence" which I'll use for the rest of post)

You can access the list of steps through a for loop from 0 to RunState.Sequence.Main.GetNumElements() -1.

First call the current object RunState.Sequence.Main.GetPropertyObjectByOffset(index,0)

With this Object, you can determine things like name, step type, etc.

Name: RunState.Sequence.Main.GetPropertyObjectByOffset(index,0).Name

Type Name: RunState.Sequence.Main.GetPropertyObjectByOffset(index,0).Type.TypeName

You will have to use this information to determine what items you include and ignore. For example, you can use the Type name to determine labels and ignore them. Depending on your coding, you may use name or Type name to determine your setup/cleanup routine steps and ignore them.

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 2 of 4
(3,560 Views)

For an example if I have sequence file composed of 3 tests, startup, cleanup and multiple labels, how would I go about sorting out the data I want. In this cause my 3 tests are in my Main in the Main Sequence and I am only interested in getting 3 lines of data for the name of the test currently being run. I want to be able to ignore the Label steps, startup expression, and cleanup expression.

I am attempting to just get back the following when a test runs:

Main Sequnce > Test A 

Main Seqence > Test B 

Main Sequence > Test C

 

this way I only get back the test name in the the Main of my Main Sequence without any call functions, labels, or expressions listed from startup or cleanup

0 Kudos
Message 3 of 4
(3,557 Views)

It's all about where and when you want to access the data and how the sequence is defined. Ideally you put your setup in the setup group, your cleanup in cleanup group, and your labels and tests in main group.

If you are collecting this INSIDE running the test, IE displaying the Test Name in your UI. You could just do a preexpression on each Tests you have with Step.Name. Here you can send it via UIMessage, store in an array, etc to collect your into.

 

If are you collecting this OUTSIDE of running the test, it's a little more difficult.

1) Firstly, you need to get access to the sequence in question. Commonly done through SequenceFileObject = RunState.Engine.GetSequenceFileEx(filepath)

2) Loop through all the steps and determine name if if keeping it

Locals.SequenceFileObject.AsSequenceFile.GetSequenceByName("Sequence Name").AsSequence.GetNumSteps(StepGroup_Main) <--determines number of steps in Main group

Locals.SequenceFileObject.AsSequenceFile.GetSequenceByName("Sequence Name").AsSequence.GetStep(index,StepGroup_Main).Type.TypeName <-determines if type is label and you can use to ignore

Locals.SequenceFileObject.AsSequenceFile.GetSequenceByName("Sequence Name").AsSequence.GetStep(index,StepGroup_Main).Name <--step's name

 

3) Close access to sequence file. RunState.Engine.ReleaseSequenceFileEx(SequenceFileObject)

 

 

 

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 4 of 4
(3,543 Views)