NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Get step name from post expression

Hi,
 
I am trying to create a custom step type that records the step name and step results in an array. I have been having trouble trying to access the Step Name property from the post-expressions tab.
 
One option is to use locals.resultslist[], however, that is only populated once the step executes and hence i cannot access its name through post-expressions. Is there any other property that contains the step name, that may be populated correctly before the post expression  is executed?
0 Kudos
Message 1 of 7
(4,213 Views)
RunState.Sequence.Main["StepName"].Name  This will only work in TestStand 4.0.  It is an API call.  Which you can do in expressions in 4.0. 
 
If you are using 3.5 or older you will have to wait for the step to finish executing and get the name from the ResultList....
OR
have a substep that calls into the API and returns the name.
 
Hope this helps,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 7
(4,207 Views)
HeatherTcore,
 
If you are using TestStand 4.0, you can access the currently running step's name in a post-expression simply by typing "Step.Name."  This uses the TestStand API to access the step's object and retrieve it's name.
 
If you are using an earlier version of TestStand you cannot access the API through expressions. In this case since you are building a custom step I would recommend creating a post-step substep rather than a post expression.  This substep would use the ActiveX Module Adapter to access the TestStand API and retrieve the same information.
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 3 of 7
(4,204 Views)
Hello HeatherTcore,

You will get it by following Josh's method.



Message Edited by My NI on 11-20-2007 04:58 PM
Regards
MY
0 Kudos
Message 4 of 7
(4,198 Views)
If you are using 3.5 or earlier (or even 4.0), you can use the expression NameOf() on the step object you wish to get.

Allen P.
NI
0 Kudos
Message 5 of 7
(4,180 Views)

Thanks for your feedback and suggestions. The following method worked: NameOf(Step) for the purposes of retrieving the currently executing step name from post-expressions.

I am trying to use this as a step type that has a specific post expression. However, now the problem I run into is that it becomes the default expression. If I insert anything else into the post expression field of this new step type, my initial statement gets overridden. Is there a way for me to make the expression specified in the custom step type such that it always executes this expression, and is also able to accept other expressions inserted when an instance of this step type is created in the sequence file?

Again, thanks for your swift response to the previous question.

0 Kudos
Message 6 of 7
(4,114 Views)
Hey Heather,

It sounds like what you are wanting to do with the "Default Post-Expression" for a custom step type might better be done with a Post-Step of that custom step type.  You mentioned that you are wanting this action to be performed regardless of what the user has configured.  If that is the case, a Post-Step would ensure that a user could not change the post-expression that you are wanting. 

This is the behavior of the "Default Expressions"/"Apply to all loaded instances" option with custom step types, but this would be a way around that behavior.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 7 of 7
(4,048 Views)