NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Selectively report loop iteration results

Solved!
Go to solution

Is there a way to selectively report only certain iterations of a looped step? For example, I have a step that uses a variable to determine the amount of times it will loop. If a loop iteration passes, I do not want to record the iteration of the loop. However, if it fails then I want to record the iteration.

 

I have gotten close by using a post expression of "Step.RecordLoopIterationResults", however appears to be delayed by one iteration of the loop. So if I'm on a loop index of 4 and set the "Step.RecordLoopIterationResults" to True, then the next loop iteration (loop index of 5) is actually recorded. If I set "Step.RecordLoopIterationResults" to False on loop index of 5, then loop 5 is still recorded but 6 is not. Obviously it's changing the flag at the end of the step but evaluating it's action at the beginning of the step. I don't know if I want to record until the end of the step :(.

 

Anyone have a way to do this? It feels like I'm really close, but can't quite get there.

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

Attached is a solution that might work for you.  Check it out and let me know if this will work.  You could precondition the step inside of the engine callback to only look for steps with a certain name or if looping is on.

 

Cheers,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 3
(2,107 Views)
Solution
Accepted by topic author Raydur

Hi - thanks for taking a crack at it.

I think the solution you provided would remove all passed steps in the entire test, and as you noted could likely be improved using some additional preconditions. I think this could be made to work, but I would much prefer a "self-contained" solution - one that doesn't require someone looking at the code to either already know that something "hidden" is being done elsewhere. There are many other loops in the test and it would get a bit messy to have to accommodate every other one. If there was a use-case that was global then this would be a simple way to achieve what is needed.

 

I modified your approach to instead have a step immediately after the loop that simply removes Passed steps from the result list of the immediate subsequence. It now works as is and while not self-contained to the single step, it is the step immediately after it that is performing the cleansing. I think it's easier to follow this way. This may have to be modified slightly depending on the other steps in the subsequence and how you want it to handle those results, but works for my purposes as is.

Thanks for the suggestion - it allowed me to get it where I needed it!

I will attach the modified file if someone can tell me how to do so. I see a way to upload a photo and a video (or insert a link), but not a way to upload a sequence file? Turns out I needed to use Chrome to edit the post and then the file upload button showed up. Wasn't there in IE (my work makes me use it...).

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