LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which control caused cluster value change event ?

Is there a way to determine which control in a cluster caused the cluster's <All Elements> value change event to fire ?  I have a cluster with several (5 to 10) numeric (and possibly some boolean) controls.  I need to perform a slightly different action when each individual control's value changes.  Therefore I need to know which control actually caused the cluster's value change event to occur.  Separate events for each control's value change could be used instead but is there a way to only have one event for the overall cluster value change and then perform the individual action within that one event ?
 
Steve
 
0 Kudos
Message 1 of 4
(3,271 Views)
Hi Steve,

in the event structure you should get a 'New value' and 'Old value' item at the left border. Use them with comparison to get the changed element!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,260 Views)

Gerd,

Thanks.  I use a Not Equal comparison on the Old and New cluster values, then Cluster to Array, then Search 1D Array with True as the element to search for.  This yields the index of the changed control in the cluster which can be wired to a Case.

Steve

0 Kudos
Message 3 of 4
(3,250 Views)
The techniques the others have cited is basically correct. The only thing to be aware of is that of your data contains floats it might not always work. There are two reasons for this is the floating-point value NaN (not-a-number). Any comparisons involving it will come out False. Hence:

(1 < NaN) = false
(1 > NaN )= false
(NaN = NaN) = false
(NaN <> NaN) = false

The second problem is rounding error. As someone on the forum found out recently:

(4.7 < 4.7) = false
((4.6 +.1) < 4.7) = TRUE

If the cluster is all data that is user input you'll probibly get away with it, but if there are calculations involved in deriving the values you are on potentially very thin ice. Food for thought...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(3,246 Views)