LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing User Event data from dynamic task node....what is wrong here?

I have a user event and an event handler. When I register the event within my "init" state and run the reference into the dynamic node then I should be able to  access the data in the event data window. I register the user event and then run the reference number through a shift register, then unbundle and run to the event handler node but I can't access the data. message is not in the drop down list for the event node data. I can only access when I don't run the reference through the shift register.  

 

Some pictures below. I'm running a state machine so I register the user event in the initialization state and then unbundle the reference in the "wait state". What is significant about bundling the refnum and then unbundling that causes my data "message" to not be accessible? I can register for events outside of the loop state machine, or just as a check below directly at the wait state and then I can access my data, just a string called message.

Any ideas?

user event issue 1.PNGuser event issue 2.PNGuser event issue 3.PNG

Adam R Baker
Cummins Inc.
0 Kudos
Message 1 of 3
(1,277 Views)

Just a few minutes after I posted I found the fix. If I deleted the refnum constant in my data cluster and then recreated and it now works. I guess the refnum saved in the data cluster has built in property for the data type and I must of changed the user event data after creating the refnum.

 

 

 

user event issue 4.PNG

Adam R Baker
Cummins Inc.
0 Kudos
Message 2 of 3
(1,266 Views)

Yes this is the problem with dynamically registering events, combined with a strict data type language like LabVIEW.  For me the solution was to use another uninitialized shift register on the ref data type.  This meant that the init case could change the data type by registering for whatever it wanted, and then the type would be updated everywhere since there was no ref constant sitting around with a hard coded data type.  I've seen JKI use a similar technique on their state machine objects design. 

 

Example_VI_BD.png

0 Kudos
Message 3 of 3
(1,150 Views)