NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Active Participant
Timmar
Posts: 270
0 Kudos

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 2011 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
Knight of NI
Posts: 18,064
0 Kudos

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

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

Member
AustinCann
Posts: 120
0 Kudos

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

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.

 

 

Active Participant
dkfire
Posts: 422
0 Kudos

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


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.

Knight of NI
RavensFan
Posts: 13,243
0 Kudos

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

Active Participant
stevem181
Posts: 231
0 Kudos

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

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.
--------------------------------------------------------------------------------------------------------------------------
Active Participant
Timmar
Posts: 270
0 Kudos

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

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 2011 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
Active Participant
Timmar
Posts: 270
0 Kudos

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

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 2011 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page