LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Brian80550

Change the for loop to pass out an error if it recieves an error and an empty array as inputs

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.

I found a weird configuration in my stuff where a program was not working right because it was clearing out the error code inside a for loop.  The for loop was clearing out the error code because it received an empty array from a property node for an array.  The property node sent an empty array to the for loop because it received an error on its input. 

 

In the VI where I found this configuration I have an error wire going thru a property node for an array.  The values read from the property node are then fed into a for loop and processed.  The error wire is fed thru the for loop and then the error is passed back out of the loop in an indexed tunnel and combined with an merge error.  When the property node has an error on its input it outputs an empty array.  The empty array is then fed into the for loop causing the for loop not to run.  The for loop then sends out an empty error wire without the error code that was sent in. 

 

I am attaching a simple VI to demonstrate this behaviour.  To see the behaviour toggle the error control on and off. 

 

edit: I forgot to set the default values in the in array on the original attachment

3 Comments
crossrulz
Knight of NI

Simple fix is to just use a Shift Register for your error input.  This will allow anything written to the shift register outside (your previous error) to be passed out when the FOR loop is iterated 0 times.  This has been known for a very long time and burned many many people.  I still do not consider it a bug (even after being burned).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
cowen71
Member

I agree with crossrulz but also completely understand why this is requested.

 

In these instances, a shift-register is your friend. And this is needed for any data you want passing through the For-Loop (asuming an empty array arrives) and is not specific to the error cluster.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.