11-01-2013 04:18 PM
I'm trying to impliment proper error handling for a datalogging program. I have a subvi that reads from several bound variables, each of which has its own error in and error out. Is it okay to wire them in parallel as I have shown in the attached picture or do I need to put them all in series? I thought it looked a lot cleaner to have all the tags stacked nice and neat, but I'm more interested in learning the correct way.
Thanks in advance.
Solved! Go to Solution.
11-01-2013 04:41 PM
You have to be careful when you have multiple error sources. There is nothing "Wrong" with what you've shown HOWEVER, only the first error will make it to your simple error handler. In your png you aren't doing anything like warning the user here but you are returning the error back to the caller. Did you hide the most important error?
Now lets look at that string constant. go back and read the help on that simple error handler....
Now that you read that help it doesn't make a lot of sense does it?
11-01-2013 04:42 PM
That will work. The difference between the way you are wiring it and putting them in series is if you wire them in series the variables will be read in that order whereas in parallel you don't know what order they will be read. The error reporting will work either way and one is not "better" than the other. It will all depend on your needs.
11-01-2013 04:44 PM - edited 11-01-2013 04:47 PM
Shared variables all communicate through the same process, so accessing multiple variables in parallel can cause performance problems due to scheduling conflicts. It is better to serialize the shared variable calls to better optimize performance. See the Use Shared Variabes Effectively help topic for more details.
In general, it isn't helpful to parallelize small snippets of code like you are doing, unless there is a specific need for concurrent execution.
11-01-2013 04:54 PM
Instead, make an array of errors (you can use "build array" in place of the "merge errors") and then you can report each and every error you encountered.
11-01-2013 05:17 PM
That link is very helpful, thank you.
11-01-2013 05:18 PM
You're right, I missinterpreted the tooltip. Thank's for pointing that out.