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: 

typedef to array

Solved!
Go to solution

Hi

I have a type def containing some booleans, arrays, etc.. and I would like to check which element was changed in the Event Structure. My first tought was to compare the two clusters, get an array of booleans and follow with a For loop. But I found that I can not convert this to an array.The error is something like "A polymorph terminal can not accept this type of data".

See figure

 

 

nitad54448_0-1582033162562.png

 

Any other suggestions on how to accomplish this ? (I do not want to make 7 or 8 user events for each element).

thanks

0 Kudos
Message 1 of 9
(2,909 Views)

Something like this may help:

example.png

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 9
(2,890 Views)

Hi nitad,

 

how does your cluster look like?

Can you share the typedef (or atleast show an image of the context help for this cluster)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(2,882 Views)

Hi

This is my cluster

nitad54448_0-1582035011464.png

 

The cluster of boolean looks like this

nitad54448_1-1582035050936.png

so the comparison of the two TypeDefs having the array is giving the problem ?

thanks

 

0 Kudos
Message 4 of 9
(2,876 Views)
Solution
Accepted by topic author nitad54448

Just playing around real quick, I am seeing that if you have an array or a cluster inside of your cluster, it won't work.  But you could unbundle everything, do some manipulations on the array or cluster, and bundle everything back together.  For instance, you can use the OR Array Elements to convert the array comparison into a single Boolean result and bundle that back into the cluster.  In the case of the cluster, you can directly unbundle (by name) the elements of the internal cluster and bundle everything together.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 9
(2,872 Views)

Sorry, the example I uploaded work only for simple types, not for arrays or clusters in your main cluster.

For arrays, things get a little more complicated.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 9
(2,868 Views)

@crossrulz  ha scritto:

Just playing around real quick, I am seeing that if you have an array or a cluster inside of your cluster, it won't work.  But you could unbundle everything, do some manipulations on the array or cluster, and bundle everything back together.  For instance, you can use the OR Array Elements to convert the array comparison into a single Boolean result and bundle that back into the cluster.  In the case of the cluster, you can directly unbundle (by name) the elements of the internal cluster and bundle everything together.


Good, just beware that the Array part works only if they the same number of elements.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 9
(2,861 Views)

oh,.. you are right, the array may have a different number of elements...

 

0 Kudos
Message 8 of 9
(2,853 Views)
Solution
Accepted by topic author nitad54448

@pincpanter wrote:

Good, just beware that the Array part works only if they the same number of elements.


That is a valid point.  If that is a concern, you would need to unbundle before the comparison, use the Not Equal with the "Aggregrate" mode on each element of your main cluster, and then bundle everything back together (or just Build Array from that point).

 

Though, since we are dealing with an Event Structure, you can just make an event case for each element in the main cluster!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 9
(2,851 Views)