LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Index Digital waveform by name not working

I am sure there is something I am doing wrong but...

 

I have an array of digital waveforms. I want to index them by channel name and not index. This makes fro more readable and less easily breakable code. Each waveform is named a unique name. I can index a particular channel by integer but I cannot index a channel by name.

 

This works:

flycast_0-1621948425055.png

This does not:

flycast_1-1621948500500.png

 

I have confirmed the name in the channel definition. I have also indexed the channel index and retrieved the name using "NI_ChannelName" and the correct name is retrieved. I am not getting any errors.

 

flycast_2-1621949276694.png

 

 

What could I be doing wrong?

0 Kudos
Message 1 of 17
(2,727 Views)

Best as I can tell, it doesn't work indexing by a string with "channel name". I went so far as to set attribute "NI_ChannelName" then get attribute "NI_ChannelName", loop that result back around the loop and do another get attribute "NI_ChannelName" with no result. I made various changes to the string (space, no space, underscore, quotes, whatever) and I couldn't come up with something that worked.

While I can think of workarounds, this seems like a legitimate method of indexing a waveform that doesn't actually work.

I must be missing the obvious too.

0 Kudos
Message 2 of 17
(2,654 Views)

I found the issue. There was a bug in my version of the prewritten VI shipped with LabVIEW “DWDT Index Channel by Name.vi” that indexes digital waveform arrays by name. It was looking for the attribute "Channel Name" when it should have been looking for "NI_ChannelName". This caused the VI to noty find anything because there is no attribute called "Channel Name".

 

Bug:

flycast_0-1623791545742.png

 

Fixed:

flycast_1-1623791555705.png

 

Message 3 of 17
(2,616 Views)

Good catch. Did you report the bug to NI? If not, can you? It might require that you have access to the SSP (Standard Service Program) - if you don't have this let us know and I or someone else can report it and link to this thread in case nobody from NI sees this post.


GCentral
0 Kudos
Message 4 of 17
(2,599 Views)

Well, I feel embarrassed. The answer was pretty much in my previous post. "Channel Name" isn't a default attribute for a waveform, but NI_ChannelName is. So trying to index by a waveform attribute that doesn't exist (you could add a "Channel Name" attribute though) isn't going to work and isn't a bug.

 

Smack forehead, learn the lesson and go on 😶

0 Kudos
Message 5 of 17
(2,583 Views)

Me too!

I did discover that you can open the prewritten VI's that come from NI and edit them. That is what I did in this case. If NI does not fix it before the next release then it will be an issue though! I have the tech support person creating a bug report.

0 Kudos
Message 6 of 17
(2,571 Views)

@flycast wrote:

Me too!

I did discover that you can open the prewritten VI's that come from NI and edit them. That is what I did in this case. If NI does not fix it before the next release then it will be an issue though! I have the tech support person creating a bug report.


This not a good solution!  It will only work on your installation.  Unless, you meant that you copied it somewhere and changed it.  That is perfectly acceptable.  In that case, it would be good to rename it so that LV doesn't outsmart itself and find it in vi.lib when someone opens it on their PC.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 17
(2,568 Views)

@billko wrote:

@flycast wrote:

Me too!

I did discover that you can open the prewritten VI's that come from NI and edit them. That is what I did in this case. If NI does not fix it before the next release then it will be an issue though! I have the tech support person creating a bug report.


This not a good solution!  It will only work on your installation.  Unless, you meant that you copied it somewhere and changed it.  That is perfectly acceptable.  In that case, it would be good to rename it so that LV doesn't outsmart itself and find it in vi.lib when someone opens it on their PC.


Yes, I agree. Currently I am having an issue getting the tech support person to create a bug report for some reason.

0 Kudos
Message 8 of 17
(2,520 Views)

I've been struggling with this with a NI support person since May 25th. I was trying to get a digital waveform out of a digital waveform array by channel name. It wasn't working. As I looked into this I found what I think is a bug.

 

Index waveform array is polymorphic. It will allow you to search for a channel using a channel name string.

 

Analog waveform array case:

If you wire an array of analog waveforms to the waveform array and a string to channel name then it finds a waveform in the array by channel name. The vi that does this is called "WDT Index Channel by Name DBL.vi". It uses "NI_ChannelName" as the attribute name to search:

 

flycast_1-1625667082352.png

 

Digital waveform array case:

If you wire an array of digital waveforms to the waveform array and a string to channel name then it should find a waveform in the array by channel name. The vi that does this is called "DWDT Index Channel by Name.vi". It looks like this and uses "Channel Name" as the attribute name to search:

 

flycast_2-1625667212407.png

 

I have attached a VI that works for analog but not for digital. If someone could please confirm that the analog version works but their digital version does not in your environment I would greatly appreciate it.

 

Is this a bug or am I misunderstanding something?

 

0 Kudos
Message 9 of 17
(2,302 Views)

Flycast, you are correct - index digital waveform by name uses "Channel Name" not "NI_ChannelName" as all the other index by channel name options in the polymorphic vi. I have to call it a mistake or bug, why would the digital index by name be different from all the analog index by name options.

 

Good find!

 

Using LabVIEW 2020 32 bit here!

 

0 Kudos
Message 10 of 17
(2,291 Views)