LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass control name to SUBVI

Hi
I created a malleable for read/write INI cluster with input as variant such that I can reuse it many places. It is working good but I cannot write the data with correct section. 
Let say, I'm connecting a cluster with name "Test" to this 'Read INI'. I'm unable to read the data since the malleable VI trying to read the section "Cluster Input" instead of "Test". 

Expected solution:
Any way to pass the control name of cluster control from main vi to subvi i.e., SubVI should get the control name from the main vi (calling vi).

Thanks in advance!


0 Kudos
Message 1 of 9
(2,709 Views)

hi PamanabanJ!

sorry i can not give you specific help, since i have not worked with malleable VIs.

 

but i had a similar problem of having a VI that needed to have lots of differing inputs,

for which i only wanted one terminal.

 

what i did was first to have type definitions for my datastructures (e.g. clusters),

and then either test for the successful variant-to-data for these typedefinitions

or have another terminal (e.g. an enum) which holds the information what data the variant really is (and then select the appropriate typedef for the variant-to-data).

 

i presume that you can go a similar way with malleable VIs, but as i said before,
i have no working experience with them.

 

regards

 

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 9
(2,675 Views)

Capture.PNG

 

One of these gets you the name of the control from the variant data.  I forget which.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 9
(2,652 Views)

@billko wrote:

Capture.PNG

 

One of these gets you the name of the control from the variant data.  I forget which.


I am not sure this will work, I suspect it will return the name associated with the subVI's terminal control, not the name of the control from the caller.

 

To work in the way the OP would like, it would need to dynamically change the subVI terminal name depending on who calls it. I don't think that's going to be possible.

 

The control reference from the calling VI could be passed in, then use a (ctrl)value and (crtl)name property nodes inside the subVI, but that's limiting as it doesn't work for constants.

 

0xDEAD

 

 

0 Kudos
Message 4 of 9
(2,647 Views)

@deceased wrote:

@billko wrote:

Capture.PNG

 

One of these gets you the name of the control from the variant data.  I forget which.


I am not sure this will work, I suspect it will return the name associated with the subVI's terminal control, not the name of the control from the caller.

 

To work in the way the OP would like, it would need to dynamically change the subVI terminal name depending on who calls it. I don't think that's going to be possible.

 

The control reference from the calling VI could be passed in, then use a (ctrl)value and (crtl)name property nodes inside the subVI, but that's limiting as it doesn't work for constants.

 

0xDEAD

 

 


Actually I have a subVI based on the action I was describing used in multiple places.  It took the name of the control wired to it and made it part of an automatically generated section name for a config file.

 

Edit: Wow, I didn't notice it, but I even used it one level down as a sub-subVI and it returned the name of the control that was wired one level up.  I got lucky there.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 9
(2,643 Views)

You're looking for "Get type information", which is at the top left of the palette screenshot posted above.

Get type information to Name.PNG

 

As soon as the conversion to Variant is done, the control name is saved in it, so you can pass it on to as many sub-sub-sub-VIs as you need to.

Message 6 of 9
(2,636 Views)

@Kyle97330 wrote:

You're looking for "Get type information", which is at the top left of the palette screenshot posted above.

Get type information to Name.PNG

 

As soon as the conversion to Variant is done, the control name is saved in it, so you can pass it on to as many sub-sub-sub-VIs as you need to.


Whew!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 9
(2,630 Views)

What sorcery is this?

Just tested for myself and indeed you are correct.

 

Kudos both.

 

0xDEAD

Message 8 of 9
(2,627 Views)

@deceased wrote:

What sorcery is this?

Just tested for myself and indeed you are correct.

 

Kudos both.

 

0xDEAD


LOL, that's what I said when the name propagated to my sub-subVI.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 9 of 9
(2,591 Views)