From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I Call the MainVI from its SubVI, and this happen recursively?

Smiley Happy
Hi All,

How can I Call the MainVI from its SubVI, and this happen recursively?
Actually, LAbView 7.1 doesn't support recurssion?
Plz help me out!
0 Kudos
Message 1 of 9
(3,284 Views)
Hi Mishra,

did you search for recursion here in the forum? You can find a lot of threads on the topic (like this)!

Because of dataflow recursion is somewhat tricky to achieve - but it's possible! And it's possible independently of the labview version...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,280 Views)

Hi Mishra_RnD,

you can try to use the "Call by Reference Node". But why do you need recursion? What is about using loops?

Mike

0 Kudos
Message 3 of 9
(3,279 Views)
It would be interesting to know a little bit more about what you are trying to do because there might be other solutions...
0 Kudos
Message 4 of 9
(3,275 Views)
Hi Mike,

Thanks n nice to get this response from u.
But, I had already tried to call the main VI from the SubVI using "call by reference" many a times...but all in vain...
Plz suggest me other solutions...

With best of regards
Mishra_RnD

0 Kudos
Message 5 of 9
(3,241 Views)
Hi Mishra,

as told by other:
Please provide more details on your aim and/or attach your (stripped down) vis. We already told you how to do recursion in LabView!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,233 Views)
Smiley Happy
Dear GerdW,

Thanks a lot 2 all of u guys,for all the brilliant responses.

Actually, my basic aim is to call the Main VI, containing a SubVI.....
Now, I want to call my main VI from this SubVI...recursively!!!!!..but whenever I tried to put the MainVI in this SubVI..an error message pops out saying recursive calling is not possible.

I also tried using "Call by reference" but tht also didn't worked...an d error is somewat like...VI is invalid..or type matching..or state matching error.

Here, Im attaching the snapshot of the MainVI... Im calling the SUBvi from it... It is running GOOD n FINE...
But prob arrives when I call the Main from the SUBvi, which looks like same as MainVI(with little differences).

I hope, Im clear in my words n not being ambigous.
Plz, correct me where ever  im wrong.

Thank You.



Mishra_RnD



0 Kudos
Message 7 of 9
(3,217 Views)

Hi Mishra,

here is a small exmple for you for recursion. It is like described in the link from GerdW.

Hope it helps.

Mike

0 Kudos
Message 8 of 9
(3,215 Views)
Hi Mishra,

to make my question more clear: With "What's your aim?" I meant: "Why do you insist on using recursion?"
Most often there's a better solution (in LV terms Smiley Wink).

Please provide more information than just a screenshot and some unclear error descriptions!
Again: Why insist on recursion? Do you want to move data to the main vi? Do you want to restart a process?
Did you set the proper vi "class" when using the CallByReference node? What's the error code in when you run your vi?

So many questions and all you say is "I want recursion!"...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(3,207 Views)