LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event case loses connection to data structure when data structure is modified

I have a complex data structure (control). I use the event structure to take actions based on changes to the data structure. I am still developing the code and so at times I end up editing the data structure. When I edit the data structure (I am using type definitions) the event cases that are based on elements of the data structure loose their connection to the event structure and I get an error in the event structure. Is there a more elegant way to handle events so that the data structure can be modified without loosing previous programming?
0 Kudos
Message 1 of 8
(3,248 Views)
HI Monroe,

Have you tried to use "strict type def's"?

If your structure definition is changing this may help.

Please forgive if not.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 8
(3,248 Views)
Ben,
I tried both strict and regular type defininitions. The data structure definition is changing. However, the elements of the data structure that the event structure is refering to are not changing.
0 Kudos
Message 3 of 8
(3,248 Views)
HI Monroe,

Could you post a example with instructions telling me what to do to see what you are seeing?

I can't guarentee I will be able to help, but I will try.

Curious,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(3,248 Views)
Ben,
Here is an example. The vi is called "Untitled 5.vi". When you run it if you change the value of pump control the GUI will change. If you stop the code and change "plant state" (or any other piece of the data structure) from a strict type definition to a type definition the event structure will lose the connection to the data structure.
0 Kudos
Message 5 of 8
(3,248 Views)
Hi Monroe,

Very interesting example.

I saw the same problem you mentioned.

I would be interested in what NI support has to say about this.

I made some changes to your example that will let you update the structure def without the event structure breaking.

1) Everything is now a strict type def.
2) I trigger off a change of ANY field in the data structure, and then use a compare before and after to see if the one filed I want is the field that has changed.

It would be nice if it operated the way you originally had it set-up.

If you figure out anything better, please share what you find out.

Still curious,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(3,248 Views)
Ben,
Thanks! I created a work around using a similar idea to what you did. Unfortunately it takes out some of the elegance of specific code responding to specific events. I have initiated a request with support. My hope is that in a future release they fix this bug so that events allow data structures to change just like the unbundle cluster by name does.
0 Kudos
Message 7 of 8
(3,248 Views)
"Unfortunately it takes out some of the elegance of specific code responding to specific events. "

I agree 100%!

Let me know what NI says.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 8
(3,248 Views)