06-17-2014 05:44 AM
Hello,
i have a Vi with one input "Text" and another parameter "bool".
Is it possible to check if the bool-parameter was wired if called from another vi?
Reason:
If not wired i want to write only the text to a logfile
and if wired i want to write a text + the state of the boolean value.
So something like a property "ValueIsWired" that can be used then with a tru/false case to generate different outputs.
Thx
06-17-2014 05:50 AM
Hey,
you could set the input of the sub VI to "recommended" and set the string you want to write if not wired as default (right click the control -> Data operations->make current value default ) for the control. So if it is wired it will take the string you wired, otherwise it will work with the default one.
Regards,
CMW
06-17-2014 05:52 AM
Ahh, I missed the boolean, ...
but the idea remains with the default values.
Regards, CMW
06-17-2014 06:09 AM
As far I know there is no property available. You can do it in another way, instead of giving Boolean as terminal provide a variant input and check whether it is empty or not.
06-17-2014 08:51 AM
@OnlyOne wrote:
Hello,
i have a Vi with one input "Text" and another parameter "bool".
Is it possible to check if the bool-parameter was wired if called from another vi?
Reason:
If not wired i want to write only the text to a logfile
and if wired i want to write a text + the state of the boolean value.
So something like a property "ValueIsWired" that can be used then with a tru/false case to generate different outputs.
Thx
Default bool to False, only write State if True. 🙂
/Y
06-17-2014 09:03 AM
This is a case where I would not favor a boolean. You can't tell if the value was wired with the default value or if it was unwired. Luckilly, a signed integer terminal with a -1 default would offer better options. (The Caller shoud probably never pass in a negative value) You simply need more than two possible values.
06-18-2014 04:16 AM
Hi,
I totaly agree with Jeff.
You usually use self defined default values(differents from the LV default value for every datatype) for sub-VIs for the case of unwiring these terminals.
The other possibility is using the recommended terminal setting.
For the boolean terminal, two values aren't enough. Many VIs use these '-1' default value for detecting a wired terminal.(-> timeout, DAQmx read).
Philipp
06-18-2014 05:21 AM
If you want to write the status flag, whether true or false, you'll need an extra input "include status".
/Y