NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a GoTo step from the API (C#)

I'm trying to add a GoTo step in a sequence file using the API commands and am having trouble. I have the unique ID from the step I'm trying to goto, but when I run my code, it always throws an error message "Unknown Variable or Property Name" plus the unique ID of the step I want to goto. The code I'm using to generate the step I want to goto is :

 

stepTemp.AsPropertyObject().SetValString(strTempData[2], 0, strTempData[2]);

 

Is there something wrong with my assignment? Also when I was debugging, I notice when I get the unique ID, it always starts with "ID#:" followed by the ID. Do I need to strip this off before assigning?

 

Thanks.

0 Kudos
Message 1 of 2
(3,287 Views)

You can change settings with lower level PropertyObject API calls, but something more like the following would be better:

 

step.CustomActionExpression = "True";

step.CustomTrueAction = PostActionValues.PostAction_GotoStep;

step.CustomTrueActionTargetByExpr = "\"" + idString + "\"";

 

If your step is a Goto step only the last line is needed. If your step is some other kind of step you can add goto behavior to it by using all 3 lines.

 

-Doug

0 Kudos
Message 2 of 2
(3,271 Views)