08-14-2015 03:35 AM
Hello
I am quite new at LabView and I have a question regarding the call of a subvi.
I have a subvi in my main vi that is called during the execution of the main vi. additiionally I would like to be able to call this subvi using a button.
I have already found out that i have to call a copy of this subvi and that my subvi has to be reentrant.
it kind of works, but when I push my button, the front panel of the subvi opens, but it is not running. If i push the run button of the sub vi it starts running in a new front panel and it does not function well - e.g. saving the controls to a config file is not done, when pushing the dedicated button.
What could be the reason that another front panel is opened and why is the subvi not working properly?
Thank you very much for your help.
Regards
08-14-2015 06:12 AM
Hi Lotusblüte,
I have already found out that i have to call a copy of this subvi and that my subvi has to be reentrant.
Please explain why you need to run this subVI reentrant, in two parallel instances!
Please explain how you call the VI (which options used). And please explain why you call it using an InvokeNode instead of a simple subVI call!
I would like to be able to call this subvi using a button.
Use an event structure. Or put a case structure around your subVI…
What could be the reason that another front panel is opened and why is the subvi not working properly?
You do something wrong.
Please attach your VIs to allow us to help you…
08-14-2015 08:10 AM
If you use the vi server method of open vi ref and/or open front panel, you also need to use the Invoke node Run VI.
/Y
08-14-2015 08:51 AM
Hello
Unfortunately I mustn't load up the complete VIs.
But via this code I want to open and run my subVI:
As long as my SubVI was not reentrant, I got the Error Code 1000. After researching I found the solution with running a copy via the reentrant option.
As I already mentioned in my first post, the SUBVi is automatically called from the MainVI while it's running. but I want to call another instance of the subvi to be able to change something.
I jsut got the idea that it would be helpful for you to know what my subvi is doing:
Based on the controls it can save the values into a configuration file and it can read this configuration file. By calling the additional instance via the button i just want to be able to configure the config file (to make it easier for people who have zero experience with any kind of programming and so on...) The controls of my config file contain file paths to excel sheets and names of macros.
The second task of the subvi is returning the right path and macro name given to a condition.
I hope this helps a little and does not confuse anymore
I come to think that my failure is somewhere in the posted code snippet.
Opening the front panel via a button & event case works. I just would love, if the subvi would already be running. Additionally I would like to know why the subvi opens another front panel when I click the run button of the subvi's front panel? (Yes, I know, it's because I am doing something wrong - but do you have any suggestions what it is?)
Thank you very much for your help!
Regards
08-14-2015 09:03 AM
Hi Lotusblüte,
I just would love, if the subvi would already be running.
First run the VI, the open the FP…
Additionally I would like to know why the subvi opens another front panel when I click the run button of the subvi's front panel?
You (or the user) should never be able to click any run button in an application. Hide the edit bar!
- Why do you want the user to handle two config windows? One is "automatically called" on program start, the other (identical) one when pressing a button: seems confusing to me…
- When you start your reentrant copy too: do you access the very same config files? Are you be any chance blocking access to these files so the 2nd instance cannot read/write the files? Are you getting any errors - and do you handle them?
do you have any suggestions what it is?
Can you attach your subVI?
08-14-2015 10:05 AM
Hi Gerd
Thanks for your idea. When I change Run VI and Open Front Panel it opens the SubVI running. But as soon as I choose a path for the Excel Files it stops running?
I build a smaller version of my subVI (yes, I know it does not fit the Labview guide ) But I hope it gives you an insight of what it's doing
The automatically called instance is just to return the correct file path and macro name - yes, this part should probably be another subvi.
Thank you very much and regards
08-17-2015 04:25 AM
Hello lotusbluete,
in my test the example vi does not stop, when i select some excel files.
I have replaced inside the example vi the open open vi reference with the vi reference, also some vi´s are disabled so i can run the code. For the test i used a test vi to start the example vi to better debug the behaviour.
Attached the files.
08-19-2015 07:28 AM
Thanks a lot to both of you!
After retrying everything a few days later I suddenly could open my subVis just by placing them into my mainVI.
I don't know what happened, but everything works just fine 🙂
03-01-2020 07:36 PM
can you show me some video or link the video how to do the invoke node in labview 2019.The video from the beginning until the end of the subvi in invoke node.