05-25-2021 08:30 AM
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:
This does not:
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.
What could I be doing wrong?
05-28-2021 09:33 AM
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.
06-15-2021 04:13 PM
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:
Fixed:
06-15-2021 09:23 PM
06-16-2021 07:15 AM
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 😶
06-16-2021 11:12 AM
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.
06-16-2021 11:26 AM - edited 06-16-2021 11:28 AM
@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.
06-21-2021 01:19 PM
@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.
07-07-2021 09:18 AM
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:
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:
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?
07-07-2021 10:09 AM
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!