LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using multiple copies of the same Subvi??

Hello All,
 
I am using multiple copies of the same subvi. If I change the control in one Subvi, it affects all other subvi's. Is there any workaround for this. Ideally I would like to use the subvi multiple times, however if I change the control in one subvi, it should not affect the control automatically in other subvi.
 
Thanks
0 Kudos
Message 1 of 6
(5,398 Views)
Forgive me if I got u wrongly.
 
If you are using many sub vi's of same name in many places of your code, within the same project or same program, only one of them will be used all the time. This could be the reason for the change is seen every where.
 
If this is the case, one possible solution could be to name the sub vi's differently. And ensure the renamed ones are selected at the appropriate places in your code.
 
Regards
0 Kudos
Message 2 of 6
(5,384 Views)

You can have multiple sub-vi's appear within the same VI and they can ALL be called.. even simultaneously.

There are a few ways of doing this, one of which is making the sub-vi re-entrant.

However, if I understand the question correctly, the problem is that yo want to modify a control in only one of the sub-vi's?

Well, the sub-vi's are actually vi's themselves.  And it's pointing to the same one.  So, if you modify one, you modify IT. IT meaning that you are modifying the one and only VI (or sub-vi) by that name.  You can't modify a clone of itself. 

Can you provide more details on what you are actually trying to do and maybe we can provide an appropariate solution?

Thanks,

RayR

0 Kudos
Message 3 of 6
(5,380 Views)
Thanks for the replies.
 
here is what i am trying to do. I have a main vi, in which i called the same sub vi two times. i now want that i should be able to separate the two vi and not have them inter-related ( since they are the same its probably not possible).
 
What i am trying here is that i want to use the same vi over and over again and set the value of one if its control differently for different instances. However i can do that once only. if i close LV and start back the changes that I make in one reflect back in all( probably because they are sourced from one).
 
is there a way out or how can I implement this. Hope i made some sense here.
 
 
Download All
0 Kudos
Message 4 of 6
(5,350 Views)
The VIs you posted does not really give a clue of what you are trying to do. Could you pls post it with the right sub vis and complete with connectors and sample values and some description on each calling instances ?
The Main3.vi is looking for sub.vi and not sub2.vi.
 
Anyway, there are two things:
If you are intended to have a control with different default values say 50 when called first and then 60 on second time calling, you should have the vi's named differently and call the right one with intended default value at the right place. Or else forget about default value, link the control to the connector of the sub vi and then pass the intended value to the sub vi. (See attached)
Download All
0 Kudos
Message 5 of 6
(5,333 Views)
Dravi99,

In accordance with the previous posts, from the information you have provided, the only way where you can have the "same" VI with different controls on two (or more) different instaces is to rename each instance with a different name. Otherwise, all you are doing is creating copies of the same file.
Eli S.
National Instruments
Applications Engineer
0 Kudos
Message 6 of 6
(5,299 Views)