From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-02-2015 02:08 PM
So lets say I have a reuse function that setups up my VI's front panel the way I like. It has an input for the VI reference, that it should be setting up the front panel for, but if you don't provide a reference it will get the calling VI reference using the call chain, and an Open VI Reference. It then closes this reference after it is done.
If I drop this function on a reentrant VI then things could be a bit hairy. I can still use the call chain to get the name of the clone VI, and I can still use the Open VI Reference with it. But according to LabVIEW R&D being able to open a new reference to a clone VI is not something that should work due to possible instability.
So my question is this, how can I get a reference to a clone VI, from within that clone VI, without explicity passing that reference in, in a safe way?
Because this idea exchange idea exists I assume there isn't a way.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-02-2015 02:32 PM
Oh new mild-ly related question for a bonus point. Is there a way looking at a VI Reference to know if the reference is a This VI reference?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-02-2015 04:03 PM
I guess using VI scripting you could edit calling VI to drop a "This VI" constant, then you could get its value in your subVI....!?
I'm not pretending to be an expert, just trying to get bonus points for a tough question 🙂
06-02-2015 04:10 PM
You have a GetRefnumInfo in the utility/variant folder. You can see that it's a VIref, but not specifically a this vi. For that i assume you have to get the name property and compare.
/Y
06-02-2015 04:14 PM
@Hooovahh wrote:
So my question is this, how can I get a reference to a clone VI, from within that clone VI, without explicity passing that reference in, in a safe way?
How about implementing a User event in that VI that'll return "This VI", then you dont need to open or close any ref. 🙂
/Y
06-02-2015 04:36 PM
Uh I hate multi replies in the NI forums.
@jimmy.chretien
I don't hate this idea, but at that point I could just make the subVI have the VI reference input required and force the developer to wire it up, but the intent was to make this function (and others like it) easy to use to where they didn't have to do that, the developer would just plop one of these down and things would just work. If I went the scripting route I'd probably put it as a Pre-Build VI in the build of the application.
@Yamaeda
Like you said the GetRefnumInfo just says what type of reference it is, (a VI Reference) I don't see a way to distinguish between a This reference and a non-This. Getting the VI Name will return the same for a This as it would the non-This. You can look at the clone names to see if they differ, but I'm also interested in knowing if I can make this function work for non-clone VIs too.
I'm not following the user event method. What do you mean by that?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-02-2015 05:57 PM
Check out this idea, it should work.
/Y
06-03-2015 03:32 AM
@Hooovahh wrote:
If I drop this function on a reentrant VI then things could be a bit hairy. I can still use the call chain to get the name of the clone VI, and I can still use the Open VI Reference with it. But according to LabVIEW R&D being able to open a new reference to a clone VI is not something that should work due to possible instability.
It's my impression (unconfirmed) that the issue is that the clone is not held in memory by the created second reference, and if it is removed from memory then using the reference could cause a crash or other failure. If true, this would mean that a subVI can safely use a reference created from its own call chain, as by definition all those callers are running while the subVI is.
06-03-2015 12:50 PM
@Yamaeda wrote:
Check out this idea, it should work.
This makes my use of the utility VI even more work for the developer.
I hope you are right and then getting a reference to the clone by the clone name won't cause crashy crash.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord