LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get main vi control or indicator from subvi using cluster reference

I have a MainVI control references, bundled, going into a subvi. I am seeking an excellent way to read the value of the control or indicator. I seen post for setting the control using "vi methods". Not sure how to work out the "control name". I'm thinking this is possible from the control reference and a property node.
 
Any ideas?
 
Rich J
0 Kudos
Message 1 of 9
(3,655 Views)
Let me add, I'm using 17+ controls and more to add later. I am trying to avoid using 17+ property nodes for all controls on front panel. I would like to put 1 property node in a For or Case stucture and process all the controls from this For or Case structure. How could I avoid all this wiring of property nodes? 
0 Kudos
Message 2 of 9
(3,640 Views)
Hi Richjoh

Could you post some code. I don't have a clue what you want.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 9
(3,626 Views)
I am trying to find another way to read the value of FP control w/o using variants. (I'm told variants use up more memory than necessary). I attached one my attempts below. If there is no other way to work around a variants how do I properly convert a variant to a value w/o loss of data?
 
I know how to use references to a FP control and property nodes to the control's value (no variants here). But this get messy on the block diagram if there are many FP controls.
0 Kudos
Message 4 of 9
(3,614 Views)
richjoh,
You could use the invoke node "Ctrl Val.Get All [Flat]". This returns an array of clusters of flattened data. This might be more of what you're looking for. Post to let us know.
 
Chris C
0 Kudos
Message 5 of 9
(3,604 Views)
Hi Chris C.
 
I'm not sure how to set this up. could you give me a clue or post some code. Much appreciated.
 
Are you saying I can use this to get or set a control on a vi FP? I'm trying to avoid using variants.
0 Kudos
Message 6 of 9
(3,600 Views)

Hi Rich,

 

You will get better answer from us if you post a simple example of what you are attempting.

Lacking that...

The "Variant" can be avoided if the refernce wired to the "property>>>Value" node is of the specific data type used by that control.

The "to more specific class" node can be used to cast a generic ref to the proper type. Just wire a reference of the proper type to the top terminal to cast the reference.

Generally:

You will get generic refernce when ever you get the "controls" from a cluster because this is an a array and they all have to be of the same data type.

You'll also get generic refences if you build an array of different refence types.

A possible useful trick is to use multiple "To more specific class" nodes (in a case ?) and check the error cluster it returns. If the "to more..." does NOT return an error, the "thing" was of the class you tried.

Like I said to start, You'll get better answers if you post example code.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(3,586 Views)
hey richjoh,
Check out the example called Saving and Loading Front Panel Control Configurations. This demonstrates (using the property nodes I mentioned) how to caputre all of the values of your front panel controls and indicators and write them to a file. You can then read that file and populate the controls \ indicators with the saved values. I think this should help out a little more.
 
chris C
Message 8 of 9
(3,578 Views)
Chris C.
 
Thanks, this is an excellent example of what I am trying to do. I now know when I drop an Invoke method on the block diagram, I should (right click) select the class (in my case "control") then I can set Control methods.
 
Prior to this I kept dropping an invoke node and didn't know how to set the invoke method for a control besides wiring a Control reference straight to the invoke method. Now I see, Invoke method class is "VI Server>App" when its dropped on the block diagram.
 
Smiley HappyThanks again
richjoh
 
0 Kudos
Message 9 of 9
(3,572 Views)