LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV Loop scripting issue

Solved!
Go to solution

I will admit that I am a scripting novice even though I have been using LV for many, many years, so maybe this a known issue, or maybe I am doing something wrong.

 

Question: Why does the Iteration Terminal not show instantly for the WHILE loop like it does for the FOR loop when using scripting nodes to set the state?


Both the "Show Sub-diagram Label" and "Stop if TRUE" work instantly for both loop types. The "Hide Iteration Term" however, requires clicking on the loop for it to visibly switch states.
Furthermore, if you toggle both the Subdiagram AND iteration term on the while loop at the same time, then it visibly updates immediately.

 

See attached code.

 

Steps to reproduce:

- Drop empty while loop and empty for loop on a fresh vi. (save it) (Or use the attached vi)
- Leave the empty loop block diagram visible.
- Point the "Loop Scripting.vi" at the freshly created vi.
- Toggle various combinations and observer the results of the empty loops.

 

Steps of particular interest:
- Manually set the empty while loop Iteration terminal OFF (Hidden)
- Set Hide Iteration Term FALSE
- Run the Loop scripting VI
- Observe the iteration term is NOT visible.
- click on empty while loop
- Observe the iteration term is NOW visible.
- Leave while loop selected
- Set Hide Iteration Term TRUE in the Loop Scripting vi
- Run the Loop Scripting vi
- Observe the iteration term is STILL visible.
- click *anywhere* on the BD and *not* the while loop
- The iteration term will disappear.

 

And I just noticed that the empty loop vi never wants to be re-saved ?! I am not sure if the various states are maintained between open & closing the vi, or survives a LV restart. Something else to investigate in the future.

 

 

System stats:

- LV2020 SP1 32bit

- Window 10 Pro

 

 

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
Download All
0 Kudos
Message 1 of 4
(302 Views)
Solution
Accepted by topic author Frozen

Hi Frozen,

 

Nice to welcome a new fellow scripter 😊 

You are not doing anything wrong, this seems like a diagram refresh bug.

Sadly, it can happen that new scripting features are not well tested before being released.

 

You can force the loop to refresh by doing this:

Script ForLoop Iteration Terminal.png

Also I have tested with LV2022 Q3, the bug is still present...

0 Kudos
Message 2 of 4
(232 Views)

@raphschru wrote:

Hi Frozen,

 

You are not doing anything wrong, this seems like a diagram refresh bug.

You can force the loop to refresh by doing this:

 


At first, I thought that it worked (after massaging your vi to work on my computer) But after duplicating you code into my original code, it did not work.... then I did something... and it started working. So I shut down LV and open the test vi's agian and tried it... it stopped working. So, I had to take you idea one step further....

 

Frozen_0-1669756331949.png

 

So even though your post did not totally fix the problem, it pointed me in the right direction. Thanks!

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 3 of 4
(174 Views)

I noticed the "Subdiagram Label Visible" property forces a diagram refresh when its value changes, so this also refreshes the iteration terminal, which could explain some of the inconsistencies you observed...

0 Kudos
Message 4 of 4
(150 Views)