LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I prevent an event structure from unbundling a cluster?

I have noticed recently that an event structure unbundles any cluster passed to it.

 

Does anyone know how to prevent this?

 

My workaround is to double wrap my cluster or re-bundle it before passing it into a vi.

 

My clusters have 20-30 elements.Unbundled.png

Thanks in advance.

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 1 of 8
(2,600 Views)

Why are you trying to prevent this? What is the issue that you believe exists? You can select what's shown there.

0 Kudos
Message 2 of 8
(2,586 Views)

Also this could be quite useful to have this default behaviour. For instance, if your cluster contains numeric controls. You could use NewVal terminal to trigger the events at the new values of the numeric controls.

 

As mentioned, there is no issue with this behaviour. Event structure are only used to respond to the user events on the front panel unless there is some code in the timeout case. You could select which control you wish the event structure to respond to by choosing that control in the Edit Event window.

 

 

0 Kudos
Message 3 of 8
(2,574 Views)

@AustinCann wrote:

Also this could be quite useful to have this default behaviour. For instance, if your cluster contains numeric controls. You could use NewVal terminal to trigger the events at the new values of the numeric controls.

 

As mentioned, there is no issue with this behaviour. Event structure are only used to respond to the user events on the front panel unless there is some code in the timeout case. You could select which control you wish the event structure to respond to by choosing that control in the Edit Event window.

 

 


I just want to correct you a bit. It is NOT true that Event structure only responds to front panel events.

Event Structures can respond to dynamically user events, that doesn't have to be connected to a front panel control. When having dynamically user events there will not be any NewVal terminal. 

 

And for the OP, I can see the issue. If the data for the event is a cluster that contains many elements, and you would send the cluster to a sub-vi or further to other loops, you would need to bundle the cluster again in the event structure. It would be a good feature to be able to get the complete cluster or each element in the event structure.

0 Kudos
Message 4 of 8
(2,545 Views)

Note: While typing this up I see that others have provided good answers, but here is mine anyway ...

 

Although Timmar did not explicitly say it, I think the point that he is trying to make is that “User Event clusters” are handled differently than “front panel clusters” by the event structure. This variation in functionality requires that he make code changes that he would like to avoid.

 

For example, an “error in” cluster from the front panel, when used in a Value Change Event, goes in as a cluster and comes out as a cluster.

err in cluster event.png

 

The same “error in” cluster from a User Event goes in as a cluster and comes out as an unbundled cluster. (See Timmar’s example.)

 

Issues that are caused by the functionality:

 

  1. To send an incoming cluster of 20 elements or more to a subvi – you would have to re-bundle the elements
  2. A large number of elements will cover the entire left side (or more) of the event

The work around is not too difficult.

 

When you create the User Event, pre-bundle your cluster by putting it in a cluster container with the same name.

When you generate the event, bundle the cluster.

work around.png

 

I don’t think there is a way to prevent this behavior and this could be considered a feature. In the common use case where you are getting a User Event from a producer loop and want to send the data to several front panel indicators, the automatic unbundling saves you a step. Maybe that’s why NI did it this way.

 

My current project uses ~60 User Events. About half of them are “pre-bundled” as described here.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 8
(2,531 Views)

Ravens Fan,

 

I will certainly Kudos your Idea Exchange,

 

Why is it that my searches never find these posts?

 

Tim L

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 7 of 8
(2,518 Views)

Steve,

 

You hit the nail on the head, Your posting is my workaround.

 

Juck Dunnaway via Ravens Fan has clearly beaten me to the punch though (3 years ago!)

How come this one hasn't been done?

 

This one is a great one as well!

 

Expand Data Interface to Built-In Messaging Primitives

 

I think jgcode deserves credit for the initial idea in this thread


iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 8 of 8
(2,513 Views)