NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can you see the progress when using a ForEach loop?

Solved!
Go to solution

Hi,

 

I have an array with about 100 containers in it. My main thread uses a ForEach loop with an inner case structure with six possibilities. My previous program had all the steps in a very long list, executing them one by one. I find this new approach is much nicer to look at, and easier to change, but there isn't really any way of telling how far along the test is (unless you know it by heart). In the long list approach, you could see all the Done/Passed outcomes and how many remained, now there is no way of telling.

 

Any tips on making some kind of progress indication? 

 

 

0 Kudos
Message 1 of 6
(3,197 Views)

This depends on the UI you are using. NI Sequence Editor and the Full-Featured UIs coming with TestStand include a status bar. On the right side, there is a pane for "Progress Indication". This is e.g. used in the process of generation of the report (standard NI Process Models).

 

You can send a progress information using UIMsg_ProgressPercent. Just send the loop count divided by the maximum number of loops multiplied by 100 (so you get the % of the actual iteration). You will send this information using PostUIMessageEx at the beginning or end of your iteration. This function is part of the TestStand API and is supplied by the Thread class.

 

hope this helps,

Norbert

 

PS: My hint regarding the value to send presumes that the sequence contains the loop only. If you add stuff in front or after it, you might want to recalculate the % value...

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(3,196 Views)

Thank you for your answer.

 

I haven't really played with the API before. I tried adding a function at the end of my loop and inserting this " ThisContext.RunState.Thread.PostUIMessageEx(UIMsg_ProgressPercent, ThisContext.RunState.NumStepsExecuted, "", "", 0) "

 

Just to see if it works. What values should I give the last three parameters?

 

I couldn't find the "Progress Indication" pane, maybe I don't have this feature.

 

Thanks again!

0 Kudos
Message 3 of 6
(3,172 Views)
Solution
Accepted by topic author q-bertsuit

As ObjectReference parameter, you should use 'Nothing'. The last parameter (synchronuous?) you can choose true or false. Please refer to the documentation of PostUIMessageEx for further information.

 

The numeric parameter should range between 0-100. Since it is "Progress Percent", this makes sense, does it? 😉

 

The status bar has several panes, one e.g. displaying the logged in user or the used process model. The pane on the right most side will display the Progress Percent if used in your sequence.

The default reporting, as already stated, includes this feature. So if you have a sequence with e.g. 500 steps, the reporting "will have a visible progress" in that pane (with less than 100 steps, it is most often too fast to see). Remember that NI Sequence Editor and the Full Featured User Interfaces do have this feature, the Simple UI does not have it.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 6
(3,168 Views)

Thanks, I got it working now! Cheers 🙂

0 Kudos
Message 5 of 6
(3,165 Views)

I got it working now! Thanks alot 🙂

0 Kudos
Message 6 of 6
(3,164 Views)