04-28-2015 08:09 AM
I have been transferring data in a Producer/Consumer architecture via User Events. The data consisted of an array of waveforms. When I added an attribute to the waveforms the code breaks with two errors about Create User Event: User event data type is unnamed or has elements with no names or duplicate names, and Contains unwired or bad terminal.
From reading the help on user events it is not clear that arrays are even allowed: "user event data type is a cluster of elements or an individual element whose data type and label define the data type and name of the user event."
From experimentation it seems that arrays of numerics and arrays of wavefroms without attributes work. A single waveform with an attribute can also be used. But an array of the same waveform with attribute leads to a broken run arrow. It also appears that I can put the array of waveforms with attributes inside a cluster and then create the user event.
Is this a bug, an undocumented corner case, or some "feature" that I do not understand?
Searching for User Event for Array of Waveforms generates some interesting, but mostly irrelevant results.
Lynn
04-28-2015 09:20 AM
I don't work with waveforms, but a quick experiment (in 2011) shows that this is enough to break the arrow:
I would say this is a bug, if only because if I create a control from the array and wire that in, the run arrow is not broken. This also gives you a workaround - do the creation in a subVI. Another option would be typecasting, but it looks like you can't typecast a waveform. Variant to Data or Coerce to Type might also work, but I haven't tried.
04-28-2015 09:30 AM
tst wrote:
Another option would be typecasting, but it looks like you can't typecast a waveform. Variant to Data or Coerce to Type might also work, but I haven't tried.
I have also done the Flatten To String and Unflatten From String to send data around. It would be preferable to not need to do that though.
04-28-2015 09:35 AM
I discovered the same thing.
For now I think my workaround will be to run once without the user event to populate an indicator for the array of waveforms with attributes. Then change the indicator to a constant and use that to define the UE datatype. I need to remember to use only a small amount of data in the waveforms because the default program settings would make that constant be in the megabyte range.
Since the attribute variant is included in the waveform data type, it makes no sense that the value or "emptyness" of that variant should affect downstream usage.
I am inclined to call it a bug also.
Thanks.
Lynn