LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
donkdonk

Do not allow duplicate channel names for TDMS write

Status: Declined

Moved to CAR Database: CAR 641269.

When you feed the 'TDMS write' primitive with a string array containing duplicate channel names, you will get one row of data (when 'interleaved' mode is chosen) , regardless how often you write new data.

 

It took me really a long time to debug: the string array containing the channel names another developer provided was partly hidden.

The help does not warn you for this and no error or warning is thrown.

Somehow you should be warned and/or LabVIEW should add a  sequence number.

6 Comments
Hooovahh
Proven Zealot

Sorry but I'm not a fan of this idea.  If I have a spreadsheet file that I'm writing to, and I write some data to column 1, then write data to column 1 again in the same function call, I'd expect it to put all the data in column 1.  I wouldn't expect it to throw me an error or warning.  The code is doing what you asked, and is able to execute writing without any errors.  

 

If anything I'd suggest you could write a VI Analyzer test to find issues like this and search for array constants wired to the write function that have duplicate values.

donkdonk
Member

@Hooovahh,

[..]The code is doing what you asked[..]

That needs some explanation for me. At least I did not expect it to do what it actually does.

As far as I'm concerned, I expect my example to write multiple rows of data (rows if you open the datafile in excel).

With duplicate channel names it only writes data the first time; in my example having header ch0, ch1, spare.

With unique channel names it writes multiple rows; in my example having header ch0, ch1, spare, spare2.

TDMS Channel names.JPGWhy should I expect the data with duplicate channel names to be written as shown in the top excel file?

I can understand it is desirable to have unique channel names and tdms cannot handle duplicates as you can retrieve data by channel name. But I don't see the rationale behind the behavior shown in the top excel file.

 

Hooovahh
Proven Zealot

When you use the TDMS write, you are not writing to a specified column index, you are writing to a channel which is name based on a string value.  You aren't saying "Put this data in column 2 and this data into column 3".  You are saying "Put this data in the column labeled 'spare2' and if that column doesn't exist make a column and label it that."

donkdonk
Member

@Hooovah,

Thanks for your reply.

I understand TDMS write will put data in a column with a specific name.

 

But I still do not understand the different results of my two examples.

Why does my top example produce only one row of data, no matter how often I write new data (1-dim array) using TDMS write?

Hooovahh
Proven Zealot

Oh I understand now.  I think this is actually a real bug, sorry I didn't understand what you were asking for originally.  There is a work around but it likely makes the file more fragmented.  If you write each channel one at a time the TDMS write will work as you'd expect where Ch0 and Ch1 have half the number of samples as spare does.

 

Example_VI_BD.png

 

But in my opinion the TDMS driver itself should recognize this and write two samples to the same channel.  The way it is now it appears to work at the moment is the first sample is attempted to be written to.  It writes ch0, ch1, and then spare just fine, but then does trying to write the second spare.  Every write after this does nothing, and no errors are produced.  I'd suggest posting this on the forums and get a CAR assigned so NI can fix it.

Darren
Proven Zealot
Status changed to: Declined

Moved to CAR Database: CAR 641269.