11-01-2017 02:39 PM
I had a problem with a data logger, in which the CompactRIO ran out of space while it was logging using TDMS. The tdms file was still there, but I think something happened to it. When I open the TDMS file, it actually opens and reads fine in Excel, but only with the associated *.tdms_index file. Without the .tdms_index, it does not automatically generate a new one when opened. Instead, I get this error:
USI encountered an exception: TDS Exception in Initialize: Tds Error: TdsErrNotTdsFile(-2503)
USI encountered an exception: (208): Error while reading model <filename readonly='yes'>(C:\filename.tdms)</filename> (TDMS), code: 80
In addition, I can't read it using the TDMS File Viewer in labview, and I get the same -2503 error.
Is there a way to fix the file so that it can autogenerate the tdms_index file correctly? Or is the best way is to copy and paste the readable TDMS file into another xlsx file, because I would rather have it retain the TDMS type.
Best Regards,
Linus
Solved! Go to Solution.
11-01-2017 03:26 PM
There are several topics on this on the forums. The one that might work the best is the one posted here.
https://forums.ni.com/t5/DIAdem/Retreive-data-from-corrupt-TDMS-files/m-p/1551592#M13327
It basically gets rid of the last written segment in a TDMS file. If your corruption is at the end this might just recover all of your other data.
If that doesn't work for you there is a longer thread here:
https://forums.ni.com/t5/LabVIEW/Corrupted-TDMS-File/td-p/2165954
Which talks about breaking up a TDMS file into N TDMS files where each file is a segment in the original file. This can help if the corruption is in the middle of the file.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-01-2017 03:35 PM
See here the format of the TDMS file. Perhaps as a result of insufficient memory declaration the last structure was not written down completely. The idea is to crop the file so that the last record is correct.
11-01-2017 05:11 PM
Hi Hooovahh,
The RecoveryTDMSFile.vi didn't work for me. However, the second link gave me the idea of using the hex editor to edit the TDMS file. I wan't keen on using a hex editor because I had no idea what to look for. But then Borjomy's post on the TDMS file format helped a lot. Since the TDMS file has repeated patterns of collected data for each time period, I have to remove the last section of bad data right after the last good section. Each data section starts right after the hex character BF, and begins with 54 44 53 6D 0E. After I removed the bad section, the TDMS file worked!
Thanks,
Linus
02-28-2020 04:14 PM
Hi, i had the same problem: Tds Error: TdsErrNotTdsFile(-2503)
Please check your VI, in my case labview was creating a .lvm file but with the extension tdms. After I changed the program giving it the correct type of file tdms, I could read the file.