08-17-2018 02:38 AM
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!
08-17-2018 04:58 AM
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
08-17-2018 09:30 AM
One of these gets you the name of the control from the variant data. I forget which.
08-17-2018 10:17 AM
@billko wrote:
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
08-17-2018 10:30 AM - edited 08-17-2018 10:37 AM
@deceased wrote:
@billko wrote:
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.
08-17-2018 11:04 AM
You're looking for "Get type information", which is at the top left of the palette screenshot posted above.
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.
08-17-2018 11:21 AM
@Kyle97330 wrote:
You're looking for "Get type information", which is at the top left of the palette screenshot posted above.
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!
08-17-2018 11:24 AM
What sorcery is this?
Just tested for myself and indeed you are correct.
Kudos both.
0xDEAD
08-19-2018 08:51 PM
@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. 🙂