From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-20-2018 07:29 AM
Hi Community,
I have a step in a for loop and I'd like to rename it in every iteration (eg: Test 1, Test 2, Test 3 etc).
What I have noticed is that if I create a pre-expression to change the Step.Name then the in runtime the displayed step name changes only once it's execution is completed.
I thought that its because I change the name as a pre-expression, after the step started to execute, so I created a step before which tries changing the Runstate.Nextstep.Name parameter, but - to my surprise - the effect is the same, the step name changes only after its done with the execution.
This is confusing for the user, so would you mind helping me out with how to change the name of the step in a way that it changes the name before it starts executing the code its calling?
thanks!
Solved! Go to Solution.
04-20-2018 08:36 AM
I cannot reproduce the issue you describe. Please compare with attached code.
04-20-2018 08:43 AM - edited 04-20-2018 08:45 AM
Just replace the Statement step with a Wait. Copy the expression you had in Statement and set the wait time to 5s.
When you run the sequence then you'll that in the first iteration TS displays "Wait" and not test0, then in the 2nd iteration it will display test0, while it indeed executes "test1" etc.
04-20-2018 09:13 AM - edited 04-20-2018 09:21 AM
Nope, works as expected. There is something different wrong on your machine...
EDIT: Ah, i see... your statement does not refer to report, but to the execution view.
Point is that tracing only updates the position of the execution arrow and the step which has just executed. Because of this, you won't see any modification of "future steps". To work around this, you can manually send an UI Message "Trace" in the renamed step after renaming has been done.
04-20-2018 09:23 AM
Ok... could be my PC. Pls set a 10s wait time and check what do you see in the first iteration. I see "Wait" instead of Test0. Once the wait is over, the name changes to test0 and it also logs correctly to the report file.
I am using TS2016.
04-20-2018 09:32 AM
Never did that... what would the the right UI message?
thanks.
04-20-2018 09:34 AM
UIMsg_Trace
04-20-2018 09:43 AM
Alright, that solves the problem, thanks.
Is there a way to somehow do this with one step? Cause right now I need two, one statement which does the rename and the trace and the step I'd like to execute. It would be nice if I could save the statement step.
04-20-2018 09:52 AM
Use a pre-expression like
Step.Name="Step"+Str(Locals.Index),
RunState.Thread.PostUIMessageEx(UIMsg_Trace,0,"",Nothing, False)
04-20-2018 09:58 AM
Perfect!!! Thanks.