02-28-2014 04:10 AM
Hi guys,
Sorry if this has been asked before, I couldn't phrase it in a way that produced results in the search.
I want to be able to have a conditional input on a SubVI. You can have the terminal being "Required", "Recommended" and "Optional" but I want one terminal to be "Required" and if that is true then another terminal will be "Required" but I don't want it to be "Required" for general use.... Is there a funciton that does this within labview?
Added a poor picture to try and demonstrate what I mean.
I could write some default things in the code to get around it not being wired, but thought it would be good to have this option?
Many Thanks
Pete
02-28-2014 04:24 AM - edited 02-28-2014 04:25 AM
02-28-2014 08:36 AM
Is this for your programmers? If so, I would just make two VIs, one with the terminal required and one with it optional, just label the icon so the programmers can easily choose which VI to use (since they would be the only ones to see the code, anyway).
Is it for the users? If so, I'd make a parent VI in which the determining terminal leads to a case statement leading to one or the other of the above VIs. This would lead to a division of functionality into a VI and a subVI, but that may make things easier on you, anyway. One good thing about it is that you can make the subVIs have slightly different front pages where, in the one which needs no input that particular control is either invisible or just not there.
Cameron
02-28-2014 08:40 AM
Thanks for the replys,
Camerond, yes it would be for programmers, I am creating a TDMS file definer that has all the property settings within it, for the file name I have two options, one where it pops up a window to ask for a filename suffix and one where it just needs a string input for the filename. There is a boolean input to select between the two but obviously the string control input is only needed in one case.
I was just curious if there was such a method more than anything. I will put it in comments so that the programmers that inherit the code will know what to do with it.
Thanks for you both for the advice
Pete
02-28-2014 09:09 AM - edited 02-28-2014 09:10 AM
Why not just use a polymorphic VI and scrap the "true/false" input all together? That's way safer than depending on your programmers to read the labels on your controls on the connector pane. If they select instance 1, the terminal is required, if they select instance 2, it is not.