11-06-2019 12:18 PM
Is there a way to add a sub vi to each case statement option?
Without opening every case statement and manually inserting the sub vi.
I have a radio button output connected to a case statement.
Inside each case I want to the same vi with just the inputs to the vi changed.
Thanks for the help.
11-06-2019 12:44 PM
@RickDTS wrote:
Is there a way to add a sub vi to each case statement option?
Without opening every case statement and manually inserting the sub vi.
I have a radio button output connected to a case statement.
Inside each case I want to the same vi with just the inputs to the vi changed.
Thanks for the help.
No, but you can right-click the frame and select Duplicate Case.
11-06-2019 01:01 PM
Just have the subVI outside of the case structure and you can just pass all of its inputs out of the case structure.
11-06-2019 01:16 PM - edited 11-06-2019 01:17 PM
@crossrulz wrote:
Just have the subVI outside of the case structure and you can just pass all of its inputs out of the case structure.
I have to agree with crossrulz here..
If every single case inside your case structure will have the same VI then that VI does NOT belong inside the case structure.
11-06-2019 04:32 PM
@RTSLVU wrote:
@crossrulz wrote:
Just have the subVI outside of the case structure and you can just pass all of its inputs out of the case structure.
I have to agree with crossrulz here..
If every single case inside your case structure will have the same VI then that VI does NOT belong inside the case structure.
To clarify a bit:
Stuff that changes from case to case, such as different values depending on the case, belong inside the case structure. Since the subVI will be the same in all cases, it goes outside the case structure. The subVI gets fed whatever values are inside the case that was selected.
11-06-2019 06:44 PM
11-07-2019 02:03 AM
@cbutcher wrote:
If you have some cases that call a VI, and some that do not, and the cases are the same in one group of situations, you can also specify multiple matches for your Case structure.
That may or may not help you...
Although to make a point of what goes inside the case and outside, the only thing inside the cases should be the strings "Even" and "Odd".
11-07-2019 02:55 AM
@thols wrote:
@cbutcher wrote:
Although to make a point of what goes inside the case and outside, the only thing inside the cases should be the strings "Even" and "Odd".
Yes - I meant this as an example with analogies to something like
but since that wasn't what I actually showed, you're right that the 1-button dialog could (and should) have been outside of the Case Structure.
To the OP - the idea is twofold:
11-07-2019 03:35 AM
@RickDTS wrote:
Is there a way to add a sub vi to each case statement option?
Without opening every case statement and manually inserting the sub vi.
I have a radio button output connected to a case statement.
Inside each case I want to the same vi with just the inputs to the vi changed.
Thanks for the help.
The truth is: yes, you can automatically add a sub VI to each case statement option.
But I doubt it would do you any good. The question should be: "how do I prevent having to put a the same VI in every case of a case structure". That's been answered already.
You can automatically put a sub VI (even a different sub VI) in every case of a case structure with scripting.
Having said that, it's almost certainly bad advice.
Scripting is most convenient for simple repetitive tasks. This is a complex and specific task, and only used a few times at most. Unless you want to change a bad situation (old code, external code), rethink what you're doing. You'd really don't want to use scripting to create those bad situations.
If you want to call a different VI for a (large number) of cases, I'd rather look at VI Server or OO (Polymorphism).