10-07-2016 11:01 AM
Good morning,
If I were to edit the acceptable values of the input of a subVI (the control within the VI itself with coerce as the response to value outside limits), then the subVI received a value outside of those, would it correct it or error out?
Example: SubVI control is limited to input value of 100 but the control in the main VI inputs 110. Would the subVI correct it, input 110, or error out?
Thanks,
Anthony
10-07-2016 11:16 AM
The simplest thing to do is "Play Scientist" -- do the Experiment. Write such a sub-VI, call it with an "out of range" parameter, and see what value you get. What I expect to happen (I haven't done the experiment) would be that the Control that you've coerced to be, say, 0 .. 100 will simply return the Coerced value (e.g. 100) and no error.
Try it yourself, and post the Solution to your own problem ... Maybe you'll prove me to be wrong!
Bob Schor
10-07-2016 12:37 PM - edited 10-07-2016 12:38 PM
@Bob_Schor wrote:The simplest thing to do is "Play Scientist" -- do the Experiment. Write such a sub-VI, call it with an "out of range" parameter, and see what value you get. What I expect to happen (I haven't done the experiment) would be that the Control that you've coerced to be, say, 0 .. 100 will simply return the Coerced value (e.g. 100) and no error.
I have not done the experiment either, but I think this was correct in ancient LabVIEW, but this is no longer the case. The input will not be coerced. The subVI will operate on a value of 110 and not generate an error.
Now go do the experiment! 😄
10-07-2016 01:49 PM
Data entry range is only applied as the user is inputting the data (directly in to the control). You can still get values out of the entry range via local variables and passing the value into subVI.
10-07-2016 02:20 PM
And the workaround is:
NOTE: The code dependant on "In Range?" is entirely optional It is there simply as an example of a potential debug feature so you can use the call chain ring to find the offending caller. Then you know who to blame for writing code that passed in bad values to your vi
10-07-2016 05:25 PM
Finished a test and was able to try it out. As pointed to, the coersion does not stop the values from being entered into subVIs. I will probably end up just writing failsafes into the subVIs in case something is outside of range (thank goodness for that function).
Thank you everyone,
Anthony