LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to know which data type is being passed

I have a Select function in my block diagram. For the True and False statements I am passing two data types. The True statement is a is a Digital Reference data type to a numerical indicator in the front panel, and the False statement is a knob Reference data type to a gauge in the front panel as well. I am not sure what to put in the middle entry point for the Select function since it needs to have a True Boolean. Ideally I would just connect another Digital Reference data type and it would return the digital indicator in that case but the Select function only receives a boolean as an input.

0 Kudos
Message 1 of 6
(1,396 Views)

That all sounds silly. Can you explain the purpose of all this? Maybe attach some simplified code?

0 Kudos
Message 2 of 6
(1,378 Views)

There is a complex way to pass any data type in and "figure out" what it is so that you can perform the appropriate function on its actual data type.  Any LabVIEW wire can be changed to a "Variant" type and passed in as a "Variant".  If you can deduce the type carried by the Variant, you can change the Variant wire back to its original Data Type by using the "Variant to Data" type.  Fortunately, there are a series of functions on the Variant "Data Type Parsing" sub-Palette that can help you reconstruct the original data type.

 

However, a simpler method (particularly if you only have a few data types) is to create a Cluster having two parts -- an Enum that can identify the type of the "actual" data, and said data, after being converted to a Variant.  Note that variables of this type are often used as "Message" types, with the "Message" being the Enum, and the Variant being the "Data" that might be passed along with the Message.  [This type of Variable is sometimes used in Queued Message Handler routines].

 

You can see an example of this in the Queued Message Handler Project Template that ships with LabVIEW.

 

Bob Schor

0 Kudos
Message 3 of 6
(1,375 Views)

Capture.PNG

Here is an snip of the piece of logic. As you can see I am passing two data types to the select function. whichever matches the data type of the control being passed by the inner loop will make it through.

 

0 Kudos
Message 4 of 6
(1,343 Views)

There's no need for the Select. Both are Numeric refnums, it's just the graphical representation that differs.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(1,334 Views)

Hello Santima

 

If my understanding is correct you can instead do this: 

Solution 1:

Redzouz1_0-1648628940454.png

Put your numeric control in a tab, and the knob in another tab. then with the tab you will now which one is selected. 

 

Solution 2:

Use an Event Structure. Modifying the numeric or the knob will trigger the right event.

Redzouz1_1-1648629161050.png

 

Kind regards,

 

 

0 Kudos
Message 6 of 6
(1,268 Views)