LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error Cluster Propagation Issue

Solved!
Go to solution

Consider the following diagram:

 

22407i6B1E6CE2B37F3D18

 

This VI is intended to be used in a chain of VIs.

This VI copies a file to a folder, and in case of error, tries with another path of the file (located in a "backup" location)

Due to the intrinsic dataflow programming model, how can I manage the error in the arrow place????

 

The behaviour I want is this:

if (error in == true) --> skips all and propagates error_in to error_out

else { try to copy, and in case of error try with backup copy. If errors again then report the error (custom error code) }

 

Is it possible???

thanks

0 Kudos
Message 1 of 8
(4,047 Views)
Solution
Accepted by topic author Slyfer

Add an if-error-frame around the whole thing. Then it's not started if an error arrives first. Link only the output of the copy to folder to the error cluster.

0 Kudos
Message 2 of 8
(4,040 Views)

I would simply add an other case structure including both your case structure and the "copy file vi", so that "copy file" will be executed if and only if error in is FALSE...

 

Marco

0 Kudos
Message 3 of 8
(4,039 Views)

ah yes, it was trivial 🙂

 

I usually try to propagate the error without introducing if blocks, but it is not always possible

0 Kudos
Message 4 of 8
(4,028 Views)

Its really simple dude.

 

Do as per following:

1. Connect the output from "error in" to a case structure. Now when there is "error" case/condition pass the "error in" to "error out". If "no error" case/condition  then execute your code.

2.Here important thing in "no error" case is that you should not wire any thing to the "error in" terminal of "copy file to folder.vi"

 

Hence your actual error will not propagate to the 1st vi itself. So if the file doesn't get copied at 1st VI, it will generate its own error & your job is done.

 

Kudos are welcomed.

0 Kudos
Message 5 of 8
(4,021 Views)

Also, wire the error cluster through the "No Error" case rather than using the "Use default if unwired" option.  The reason for this is that a warning (error code > 0 and status = False) would be lost the way you have it wired.  Using the default would cause the warning to be lost.

 

Lynn

0 Kudos
Message 6 of 8
(4,008 Views)

thanks all,

 

the note about the "lost warning" was really interesting, I never noticed it because I never used warning.

I discovered another source of bug.

Consider the following:

22511i1EC7C04BB3A69623

If error_in is true, the error_out would be false.

The reason is that the filename array is EMPTY and the for case is never executed, so error_out takes a default value.

As a consequence the error is not correctly propagated.

I think this is not trivial to see at a first glance.

0 Kudos
Message 7 of 8
(3,961 Views)

This is a known issue.  If a for loop executes zero times, the outputs are set to default values.  For the error cluster the default is no error.  The work around is to put any signals which need to propagate through the structure into shift registers.  The output of the shift register after zero iterations will be the input value rather than the default value.

 

Lynn

0 Kudos
Message 8 of 8
(3,951 Views)