12-09-2020 10:49 AM
@~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.
12-09-2020 12:00 PM
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:
Clonable VI:
Find caller controls VI:
This would explain why the previous poster was able to get it to work temporarily but then it stopped again.
12-09-2020 12:02 PM
If that is true, you probably get the same results by hiding the front panel. That would prevent annoying flashes.
12-09-2020 01:07 PM
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?
12-09-2020 01:21 PM
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.
12-09-2020 03:03 PM
@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.....
12-09-2020 04:56 PM
@~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.
12-09-2020 06:18 PM
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.
12-10-2020 02:39 AM
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.
12-10-2020 02:54 AM
@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.