LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Caller as Clone Reference


@~jiggawax~ wrote:

Thank you for looking into this for me.  I really appreciate it.  I can't get it to display the proper thing.  I tried saving your VIs as well but same result.  It just displays the default values of the original VI and not the clones.  I really can't be the only one who has encountered this right?

 

 


wiebe@CARYA wrote:

 

After the save, I couldn't get it to fail again. See attachments.


But you say you got it to work?  Maybe it's a LabVIEW setting somewhere?


I modified your VIs to show it worked, and found out it didn't.

 

I fiddled a bit, and saved all, and then it worked and couldn't get it not to work.

 

I don't think there's a setting. I wouldn't know which one, and certainly didn't change one during this experiment.

 

Maybe a race condition? But I'm pretty sure the control input should be updated before the VI runs.

Message 11 of 22
(1,174 Views)

OK, I think it's because front panel controls on shared clone VIs only have their value property update if the front panel is shown at least once.  I made a 3-VI example.

 

To show, do the following all in one LabVIEW session (restarting makes it reset):

1. Load the top example VI.

2. Run it once without enabling the Boolean.

3. After a second, the popup will show the control values, 2 zeroes and a False.  Press OK on the popups to close them.

4. Set the top example VI's front panel Boolean to True. Run it again.

5. After a second, the popup will show the control values, one of which will be nonzero this time.  Press OK on the popups again.

6. Run the top example VI a third time, leaving the Boolean set to True.

7. After a second the popup will show a third time, this time with 2 nonzeroes (different values from last time) and a True value.

8. Run the top example VI one last time but with the Boolean set back to False.

9. After a second the popup will show 2 completely different numeric values again.

 

Top VI:

Kyle97330_0-1607536612368.png

Clonable VI:

Kyle97330_1-1607536631106.png

Find caller controls VI:

Kyle97330_2-1607536667144.png

 

This would explain why the previous poster was able to get it to work temporarily but then it stopped again.  

Download All
Message 12 of 22
(1,161 Views)

If that is true, you probably get the same results by hiding the front panel. That would prevent annoying flashes.

Message 13 of 22
(1,156 Views)

Amazing that you figured that out.  I would have never guessed that.   Thank you for looking into that.

 

Do you think this is a bug?

 

Also, assume I cannot change the code in the clone VI (or the MainVI) to make it hide or show as you both suggested.  Is there a way to solve my issue from only within the SubVI?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 14 of 22
(1,148 Views)

I have often had to write code that opens a vi front panel as "hidden" to cause the front panel to be loaded.  You can do that to your clone VI.

Message 15 of 22
(1,142 Views)

@drjdpowell wrote:

I have often had to write code that opens a vi front panel as "hidden" to cause the front panel to be loaded.  You can do that to your clone VI.


Yes I know how to open a VI as hidden.  However, if you look closely at my scenario I cannot get the reference to the clone VI in the sub VI without opening the clone VI panel.....

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 16 of 22
(1,132 Views)

@~jiggawax~ wrote:

@drjdpowell wrote:

I have often had to write code that opens a vi front panel as "hidden" to cause the front panel to be loaded.  You can do that to your clone VI.


Yes I know how to open a VI as hidden.  However, if you look closely at my scenario I cannot get the reference to the clone VI in the sub VI without opening the clone VI panel.....


Sorry, I don't see why that would be true.  

Message 17 of 22
(1,117 Views)

Well, the other 2 posters have confirmed what I'm seeing and why it is happening.  Basically if you understand the issue and try it out you'll see what we are all running in to.  In the subvi you cannot get a reference to the clone without opening its front panel.  If you can do it and prove it works then we'd all love to know how.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 18 of 22
(1,108 Views)

You actual did get the vi reference, and proved it by getting its clone name.  Your issue is that your vi is called before its front panel is loaded, which means the controls that are input terminals weren't updated with copies of the input values.  When you use a Value property node, you are reading the front panel's copy of the input, not the value used by the executing code.

Message 19 of 22
(1,095 Views)

@drjdpowell wrote:

You actual did get the vi reference, and proved it by getting its clone name.  Your issue is that your vi is called before its front panel is loaded, which means the controls that are input terminals weren't updated with copies of the input values.  When you use a Value property node, you are reading the front panel's copy of the input, not the value used by the executing code.


I agree.

 

You do get the clone reference. That was never the issue. It just looked wrong because Get Name didn't work as expected (Get Clone Name did).

 

The front panel controls is a different issue. 

Message 20 of 22
(1,092 Views)