07-21-2017 08:58 AM
Hi,
I send you my VI in order to give you an idea of whay my cluster array looks like. The array can contain 256 clusters. And in the clusters of the arrray, there is several elements. I would like to keep this kind of structure (array) for my programme. When the user press a button into the arrray from the IHM, I would to know by means of a reference for exemple which was the button pressed by the user. Then with this information, I would be able to treat/calcul the information. However, apparantly it is not easy... I can only know that the values contained into the array have changed, but I don't know which value has changed ... (There is only one value which change at a time). If you have any solution ... Thank you very much ! 😄
Have a nice day !
Solved! Go to Solution.
07-21-2017 10:35 AM - edited 07-21-2017 10:37 AM
Create value changed even on the array and find the changed array element by comparing old and new event node.
07-21-2017 10:47 AM
Altenbach's suggestion in image form
mcduff
07-21-2017 10:49 AM - edited 07-21-2017 10:51 AM
07-21-2017 10:56 AM
To get an "index" of the changed cluster element, convert the value from "changed element" to a boolean array using cluster to array and again search for the truth :D). The resulting index can be wired to a case structure so you can execute different code depending on which cluster element has changed.
07-21-2017 12:49 PM
@altenbach wrote:
To get an "index" of the changed cluster element, convert the value from "changed element" to a boolean array using cluster to array and again search for the truth :D).
Here is a very primitive example that shows this suggestion. It would be simple to extract the new value of the cluster element using a case structure.
07-21-2017 01:49 PM
@altenbach wrote:
Here's a quick example:
While valid for this Q, watch out for elements added to the array or deleted from the array.
Ben
07-21-2017 01:53 PM
@karivotski wrote:
Hi,
I send you my VI in order to give you an idea of whay my cluster array looks like. The array can contain 256 clusters. And in the clusters of the arrray, there is several elements. I would like to keep this kind of structure (array) for my programme. When the user press a button into the arrray from the IHM, I would to know by means of a reference for exemple which was the button pressed by the user. Then with this information, I would be able to treat/calcul the information. However, apparantly it is not easy... I can only know that the values contained into the array have changed, but I don't know which value has changed ... (There is only one value which change at a time). If you have any solution ... Thank you very much ! 😄
Have a nice day !
If you have fixed size array then you can present the information in a cluster. You still have the option to convert the cluster to an array if that makes it easier to process.
By presenting the info as a cluster you can register a single value change event for all of the cluster elements. When the event fires, the event will provide a ref to the cluster element that changed.
Just another way to attack the same beast.
Ben
07-21-2017 02:10 PM
@Ben wrote:
While valid for this Q, watch out for elements added to the array or deleted from the array.
That's why I am hiding the index display, initialize the array to a known size, make it the default value, and match the container size 😄
(But yes, we could do an array size on the old a new value from the event data node and add more code if they differ :D)
07-21-2017 02:18 PM
@altenbach wrote:
@Ben wrote:
While valid for this Q, watch out for elements added to the array or deleted from the array.That's why I am hiding the index display, initialize the array to a known size, make it the default value, and match the container size 😄
(But yes, we could do an array size on the old a new value from the event data node and add more code if they differ :D)
And adding to the previous based on past horror stories...
"Right-click Insert before" could be used to put a new element in the middle.
Ben