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.
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.
02-18-2020 07:29 AM - edited 02-18-2020 07:34 AM
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
Any other suggestions on how to accomplish this ? (I do not want to make 7 or 8 user events for each element).
thanks
Solved! Go to Solution.
02-18-2020 07:59 AM
Something like this may help:
02-18-2020 08:03 AM
02-18-2020 08:06 AM
Hi
This is my cluster
The cluster of boolean looks like this
so the comparison of the two TypeDefs having the array is giving the problem ?
thanks
02-18-2020 08:09 AM - edited 02-18-2020 08:09 AM
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.
02-18-2020 08:11 AM
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.
02-18-2020 08:15 AM
@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.
02-18-2020 08:32 AM
oh,.. you are right, the array may have a different number of elements...
02-18-2020 08:34 AM
@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!