Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Convert to CSV and back

Rank

Total Posts: 2

Joined 2016-12-16

PM

Hi,

Can anyone please help with this:

I convert a file to CSV and back like this:

java -jar FitCSVTool.jar -b 2019-05-14-06-13-03.fit 2019-05-14-06-13-03.csv -d

java -jar FitCSVTool.jar -c 2019-05-14-06-13-03.csv 2019-05-14-06-13-03_2.fit

Even if I change nothing, I alw3ays get this error (no matter what file I am converting):

FIT CSV Tool - Protocol 2.0 Profile 21.10 Release
CSVReader.read(): Error on line 2 - Unknown field "unknown" in message "file_id".
Exception in thread "main" java.lang.RuntimeException: FIT encoding error.
at com.garmin.fit.csv.CSVTool.run(CSVTool.java:258)
at com.garmin.fit.csv.CSVTool.main(CSVTool.java:332)

Ho do I fix or better, prevent, it and why do I get the error? Also it happens which ever release of the SDK I use. different files have the error on different lines. If I delete the unknown,1,, on one line, it just throws up the error for numerous other lines, too many to delete, and most of which contain data I want to keep.      

File Attachments

Rank

Total Posts: 1

Joined 2018-10-12

PM

jdc - 02 August 2019 12:10 AM
Hi,

Can anyone please help with this:

I convert a file to CSV and back like this:

java -jar FitCSVTool.jar -b 2019-05-14-06-13-03.fit 2019-05-14-06-13-03.csv -d

java -jar FitCSVTool.jar -c 2019-05-14-06-13-03.csv 2019-05-14-06-13-03_2.fit

Even if I change nothing, I alw3ays get this error (no matter what file I am converting):

FIT CSV Tool - Protocol 2.0 Profile 21.10 Release
CSVReader.read(): Error on line 2 - Unknown field "unknown" in message "file_id".
Exception in thread "main" java.lang.RuntimeException: FIT encoding error.
at com.garmin.fit.csv.CSVTool.run(CSVTool.java:258)
at com.garmin.fit.csv.CSVTool.main(CSVTool.java:332)

Ho do I fix or better, prevent, it and why do I get the error? Also it happens which ever release of the SDK I use. different files have the error on different lines. If I delete the unknown,1,, on one line, it just throws up the error for numerous other lines, too many to delete, and most of which contain data I want to keep.


Hello jdc,

The “unknown” fields/messages are created when a field/message that has not been exposed via (or is not defined in that version of) the public SDK is parsed by FitCSVTool while converting from .fit to .csv. In order to convert from the .csv file back to a .fit file all of the “unknown” fields/messages and their data would need to be removed first.
     
Rank

Total Posts: 2

Joined 2016-12-16

PM

Ah, thank you. That is a lot of deleting! Also, the exercise load from my Garmin 945 is contained in one of the unknown fields, so I'd lose that if I delete it. Am I right in assuming that perhaps with later releases of the SDK, these metrics that come with my Garmin 945 may move from unknown to known fields?      
RankRank

Total Posts: 44

Joined 2013-04-07

PM

jdc - 02 August 2019 12:10 AM

Ho do I fix or better, prevent, it … ?

Hello jdc,

I would like to show you something about the FIT file format and the SDK java CSV format.

When decoding a FIT file, if a code number of a message or a field/type is not in SDK profile, it will be stored in SDK java CSV as "unknown".
But: The code number of a message or a field/type not contained in SDK profile could also be stored in CSV as follows: "No. (not in profile)"

"unknown" can not be encoded into a FIT file, but "No. (not in profile)" can be encoded very well.
Look at the attached PDF document in field 3/7 and you will see it.

So: there's (almost) no such thing as can't be done.
Therefore, I use an independent CSV format which works well.
The CSV format is specially designed for use in Excel with "dynamic caption".

Some notes about 2019-05-14-06-13-03 excel.jpg:
- "UNDISCLOSED_No." means the same as "No. (not in profile)"
- "timestamps" are not decoded as "s" but as "date time"
- I'm not a moderator, so it may be that I decoded some content differently

I would like to offer some ideas with this post, but beyond that I am not able to offer software support.


In any case, it is better not to wait for currently unknown messages or fields/types to be included in the SDK profile.

Thanks
edge-python      

File Attachments