NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop doesn't loop when Runstate.LoopIndex is used.

Solved!
Go to solution

How does RunState.LoopIndex works? I have the following setup but Runstate.LoopIndex keeps initializing to 0 after first run.

If I use Locals.Index then for loop runs as expected.

Thanks!!

 

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 2
(850 Views)
Solution
Accepted by lvrat

RunState.LoopIndex is only valid for the life of a step and then each step resets it back to 0.... at least that's how I understand it.

 

LoopIndex should only be used for looping within a single step and not for the flow control steps.  You correct in using Locals for that.

 

From the Help:

LoopIndex Property

Syntax

SequenceContext.LoopIndex

Data Type

Long

Purpose

Specifies the value of the loop index at a given point as a step loops. The value of the loop index depends on the looping construct you select for the step.

Remarks

 

 

Note  This property returns the value of the loop index truncated to a 32-bit integer. To retrieve the underlying 64-bit floating point loop index, call SequenceContext.AsPropertyObject().GetValNumber("RunState.LoopIndex", 0).

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 2
(816 Views)