How do I use server to control for sub-vi from a main vi
> Why you think that your main.vi will not still active?It lunch
> sub.vi's and stop?
> Add while loop in main.vi. You will wait until you get results from
> all sub.vi's.
The VI's you need are on the VI server palette. You need to open a
reference to the VI you want to dynamically launch. There is a VI on
this palette to let you set the front panel values (properties) and
then you can run it with another that lets you choose the run method.
You will need to decide whether you want your main program to wait for
the dynamically launched VI or not. This is a boolean you set when
you use the run method. Also you will need to decide whether to have
the dynamically launched VI dispose of it's own references or whether
you want the main VI to do that. If the main VI does that then you
will need to Close the VI reference when you are done.
Also you will need to come up with a way to signal information back
and forth between the main VI and any dynamically launched VI's. You
can best do this with the multithreading VI's like notifiers, queues,
semaphores, etc. You can also use global variables but be careful of
race conditions that can occur. Also watch out for any shared
resources like I/O cards, test instruments, etc. that can only be
accessed by one VI at a time. If you have any of these you will need
to use semaphores to protect them or find a way to let all VI's share
the information from one I/O resource using a notifier.
If one of your dynamically launched VI's has an unexpected error you
can signal this back to the main VI using a queue as an error queue
and an occurrence to signal the main thread that an error has occurred
so that it can check the queue.
Douglas De Clue