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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get data type of dynamically loaded control file (.ctl) at runtime

If I open a control file (.ctl) that is a striclty type VI reference using the Open VI Reference function, how can I get the data type as a variant or similar during runtime showing the connector signature?

 

The front panel control only returns a raw refnum value not the data type.

 

E.g. for this type def control, I would like to get this information:

LabVIEW_2018-10-17_12-34-59.png

LabVIEW_2018-10-17_12-36-31.png



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 1 of 7
(2,634 Views)

This seems to work.

LabVIEW_2018-10-17_12-52-16.png

Now to decode the type string data...



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 2 of 7
(2,618 Views)

Look in the Data Type Parsing palette.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 7
(2,593 Views)

Thanks Paul. I'd originally dismissed that palette as the Get Refnum Information didn't return enough information, but I just had another look and found the Get VI Information which works great. Completely missed that one!

 

I see that I can get the wiring rules from the VI Info > Flags array and the terminal data from the VI Terminal Types variant array.

That certainly saves a lot of work, if only I'd seen it sooner.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 4 of 7
(2,589 Views)

Edit: I was wrong. Get VI Information doesn't work directly for controls containing a Strictly Typed VI Reference and using the ConnectorPane.DataType variant. It needs the Strict Type variant from Get Refnum Information.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 5 of 7
(2,584 Views)

The Type def is a VI, it has a front panel.

 

Use All Controls[], and get the first (and only) control. From there on, it's the same as any other control reference.

Control Type.png

Do close some refs...

Untested (don't use much type defs anymore), but pretty sure it works.

0 Kudos
Message 6 of 7
(2,580 Views)

Thanks. That also works and has an immediate benefit of not requiring scripting. I wonder how it weighs up on efficiency when compared to using the Connector Pane : Data Type property.

 

I was worried that controls may have their front panel removed and converted into some special case when compiled, but it looks like it is always guarenteed to have one.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 7 of 7
(2,574 Views)