11-18-2012 08:35 PM
How do you know what the default value for an object will be...if using a "use default if unwired" with an event case?
Is there a listing somewhere of what default values will be?
Thank you,
cayenne
11-18-2012 08:47 PM
The default value is the default for the datatype of the wire. For numerics it is zero. For strings it is an empty string. For booleans it is False. The only situation where you may find "unusual" default values is for customized controls where you set a default value for an typedefed cluster.
I am not sure if there is a listing but for any datatype dropping a control on the front panel will display the default value. On the block diagram selecting Create Constant will generate a constant with the default value.
Lynn
11-19-2012 12:19 AM
Personally, I would highly recommend disabling this on every single tunnel coming out of an event structure (with the possible exception of the tunnel going to the loop's stop terminal). If you use this option, you are almost guaranteed to forget to wire a required value into a tunnel at some point in the future when you add a new case.
More generally, I think that this option should not be the default for these tunnels. You can see more about this here and I would suggest voting it up if you agree with it - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Output-tunnels-from-event-structure-should-default-to-...
11-19-2012 12:26 AM
I agree with it and also whenever I pass wire through the tunnel I take care to unmark the option.
11-19-2012 08:29 AM
I fully agree with tst here. The only time I use the default if unwired is the loop termination tunnel. Disable it. That will save you many headaches from logical errors.
11-19-2012 08:36 AM
Just in case the OP is refering to a LVOOP class with the term "Object" the class browser will show the data members default values if they are not the default default for the datatype.
No I'm not intentionally trying to confuse the issue. But it is "clear as crystal dipped in mud."
11-19-2012 11:47 AM
@tst wrote:
Personally, I would highly recommend disabling this on every single tunnel coming out of an event structure (with the possible exception of the tunnel going to the loop's stop terminal). If you use this option, you are almost guaranteed to forget to wire a required value into a tunnel at some point in the future when you add a new case.
More generally, I think that this option should not be the default for these tunnels. You can see more about this here and I would suggest voting it up if you agree with it - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Output-tunnels-from-event-structure-should-default-to-...
VERY much agreed! Disabling the "default if unwired" option makes absolutely certain that you have considered the correct value for every case.
11-19-2012 12:09 PM
"Create Control" on that terminal, the value of that control is what the default is for the terminal.
Sometimes it's a useable value (index array), other times the VI won't run with the default values.
The rare times I do that with a VI I put the default in ()'s in the control name, like the "Error In (No Error)" wire. :dunno
11-19-2012 02:15 PM
I don't use such simplistic rules (e.g. "Always do this...", "Never do that."). When I create a tunnel, I use that lump of gray matter in my head to decide what mode it should be.
Although always disabling "default if unwired" won't lead to any real trouble, in general, blindly following simplistic rules will lead to grief.
11-19-2012 02:20 PM
@paul_a_cardinale wrote:
I don't use such simplistic rules (e.g. "Always do this...", "Never do that."). When I create a tunnel, I use that lump of gray matter in my head to decide what mode it should be.
Although always disabling "default if unwired" won't lead to any real trouble, in general, blindly following simplistic rules will lead to grief.
Yes, there are exceptions. And we have to evaluate that instance by instance. But as a general rule of thumb, it is best not to have default if unwired tunnel.