NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

change custom step labels programatically

I want to change the step label progrmatically  based on the string variable in the step specified.

Ex: If a step contains a variable "Local.name",(names: TOM, MAT).  When ever we change the name from 'tom' to 'mat' the corresponding name should be displayed in the label in the result.

0 Kudos
Message 1 of 16
(4,196 Views)

Hi,

 

If its inside the step then use Step.Name. If it's the next step then use NextStep.Name and if its the previous step then use PreviousStep.Name.

 

If its outside the step but not the next or previous, then use PropertyObject.Name. To use this first you will need to obtain a PropertyObject reference of the required Step.

 

For more information regarding these API property methods, checkout the TestStand Programmer help.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 16
(4,192 Views)
In the file attached you can see that there is a step "Action " included and the label red circled. Actually i want ot modify that label programatically.
0 Kudos
Message 3 of 16
(4,192 Views)
and that modified  label to be shown in report
0 Kudos
Message 4 of 16
(4,194 Views)

Hi,

 

Actually I have just remembered. You can not change the Step Name (Label) in the Step and have it affect the result if only called once. You have to change the value before you call the Step in question. So if you had an expression in the previous step such as NextStep.Name = "Test 1" this would change Action to Test 1 and therefore this would get recorded in the report.

 

Using an expression in the Action step such as Step.Name = "Test 1" would not change the Label but if it is in a loop you would notice that the next iteration of the step would change the Label.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 5 of 16
(4,191 Views)

Hi,

 

A correction to my last response.

 

Using the API call Step.Name in the pre-expression will change the Name of the step and the change will be seen in the report

eg Step.Name = "Do some task" will change "Action" to "Do some task".

 

Sorry for any confusion.

Regards

Ray Farmer

Regards
Ray Farmer
Message 6 of 16
(4,179 Views)
thank you for the solution, this helped me a lot.
0 Kudos
Message 7 of 16
(4,169 Views)

hi i see a problem with your solution when this preexpression is kept for the step in the type palette.

Initially i was trying to include the preexpression in the sequence which worked fine by the solution provided but when the same expression kept in type palettes the name get displayed  for the step after it i.e, it gets effect for the next step.

0 Kudos
Message 8 of 16
(4,135 Views)

hi i see a problem with your solution when this preexpression is kept for the step in the type palette.

Initially i was trying to include the preexpression in the sequence which worked fine by the solution provided but when the same expression kept in type palettes the name get displayed  for the step after it i.e, it gets effect for the next step.

0 Kudos
Message 9 of 16
(4,119 Views)

Hi,

 

Can you post a picture highlighting the problem.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 10 of 16
(4,091 Views)