Jump to content

How to detect the changing of a value in side a cluster of an array?


Recommended Posts

Hi,

I have an array of clusters. There are multiple of types of control inside these clusters (number, string, enum, boolean). If I use event structure, I can manage to find out which cluster changes and which control changes but I cannot get the actual value of that cluster. I don't know how to get the reference of the cluster.

Could you please give me a hint?

This is the part of my code:

Best regards,

Thang Nguyen

post-7703-127318050282_thumb.jpg

Edited by Thang Nguyen
Link to comment

I am sorry making you confuse. I mean I want to get the value of the control which has been updated. I can index the cluster but I cannot index the control inside that cluster.

In that case, you can use the OpenG Variant palette to get the data you want, "Cluster to Array of VData" in particular.

If your cluster's data is all from the same datatype, you can typecast it. If not, then Variant is all you can have.

Link to comment

Thank you for all of your helps.

@Minh: I like Dr Slump too thumbup1.gif

By the way anyone can tell me why there is a convert of boolean type when I use build array function? I have seen this but I don't really understand what it is.

Edited by Thang Nguyen
Link to comment

Thank you for all of your helps.

@Minh: I like Dr Slump too thumbup1.gif

By the way anyone can tell me why there is a convert of boolean type when I use build array function? I have seen this but I don't really understand what it is.

Guessing...

The original cluster was a type-def ?

Float over the wire with the wire tool active and help screen open to get the details on the wire.

Ben

Link to comment
  • 2 months later...

That depends on whether or not or you want this to be a generic tool and whether or not the cluster elements are all of the same data type. If they are all of the same type, you can simply use Thang's original suggestion but use the Cluster to Array primitive instead of manually building the array.

If not, LV 8.x should have some VIs in <vi.lib>\utility which allow working with the variant data type. It's possible one of them allows converting a cluster to an array of variants.

Link to comment
  • 2 weeks later...

Hi,

I have an array of clusters. There are multiple of types of control inside these clusters (number, string, enum, boolean). If I use event structure, I can manage to find out which cluster changes and which control changes but I cannot get the actual value of that cluster. I don't know how to get the reference of the cluster.

Could you please give me a hint?

This is the part of my code:

Best regards,

Thang Nguyen

I think this may be what you want. It will return the index of and value of the changed cluster in an array.

Find Changed Element In Array Of Clusters.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.