06-08-2013 01:43 PM - edited 06-08-2013 01:54 PM
hello,
I am trying to learn basic error handling and data flow. The attached is a simple VI to implement this.
How do I implement this code to show an error.
Thank you.
Solved! Go to Solution.
06-08-2013 01:55 PM - edited 06-08-2013 01:56 PM
You have not wired one of the outputs of ERROR side of the case structure - you can either wire it according to functionality that you want in case of an error, or right click and select "use default if unwired" (usually that means "0" unless if you have selected a specific default value). See attached photo to see red circle where your problem is.
If you click on "broken play" button on LabVIEW menu, it will tell you all issues with the vi. If you see a "play" button that means that vi has no issues.
-DP
BatchTest Corp.
NI Alliance Partner
06-08-2013 01:57 PM
Please see the attached VI. I have done this now. But I am trying to create an example which shows error out status. How can I change this code to show a Error status ?
06-08-2013 02:05 PM - edited 06-08-2013 02:08 PM
Perhaps I'm misunderstanding your purpose. You have already wired things so that your functionality will get executed as long as INPUT error cluster has no error in it. (In case of any error in the input, that error will get passed to the error OUTPUT). Now if you're meaning to implement something that you want to show as an error, then you'd have to use "bundle by name" element (under clusters) to inject a value+ optionally some text + a TRUE boolean in error cluster line.
For example in case of "Add and increment" case - if output is let's say negative, look at attached clippet in how to do that (I have only shown boolean geting a true value due to limited available area in there, but hopefully that will give you an idea in how to do it.)
If you want such error to "pop up a message", you'd have to tie an error handler to error cluster wire (right click on error cluster wire -> Dialog & User Interface Palette -> Simple Error Handler (or General Error Handler).)
-DP
BatchTest Corp.
NI Alliance Partner
06-08-2013 02:15 PM - edited 06-08-2013 02:17 PM
Yes. This is what I want to learn. To the point and precise.
So, right now
One last question. So in any VI, if I want to display a (value+ optionally some text + a TRUE boolean in error cluster line) if at all any error occurs then I jiust have to use bundle by name element under cluster wire right? What about the Value ? How do I know what error value should be given ? I think LabView assigns thats Value right ?
Thank you.
06-08-2013 02:27 PM - edited 06-08-2013 02:28 PM
You'd have to assign a value of your choice to the error cluster - in errors generated by LabVIEW functions, error is already assigned/etc but for custom user errors, the user has to assign values. Just make sure to not use same error values as what LabVIEW uses for predefined errors. If you do a search for error codes, you'll be able to find such error code ranges - so pick something that is not already use.
And yes - using an error handler would be a simple way to accomplish what you're trying to do. That Error handler will only popup a message in case of an error so your functionality will remain smooth.
-DP
BatchTest Corp.
NI Alliance Partner