Within CSV files created by FitCSVTool.jar, what's the meaning of the value column in definition message fields?

When the FitCSVTool converts a .fit file to CSV, a number is written into the field value column for each field in a definition. Using the Activity.fit and Activity.csv file from the SDK examples, this value is almost always 1, but occasionally 2 or 4. I can't find any documentation on the meaning of these values. For clarity, I've included the first few rows of Activity.csv and highlighted the values in question. 

Type Local Number Message Field 1 Value 1 Units 1 Field 2 Value 2 Units 2 Field 3 Value 3 Units 3 Field 4 Value 4 Units 4 Field 5 Value 5
Definition 0 file_id type 1 manufacturer 1 product 1 time_created 1
Data 0 file_id type 4 manufacturer 1 garmin_product 3570 time_created 955560085
Definition 0 event timestamp 1 event 1 event_type 1 data 1 event_group 1
Data 0 event timestamp 955560085 s event 0 event_type 0 timer_trigger 0 event_group 0
  • A message definition contains a list of field definitions. Where each field definition is three bytes and contains a field number, size (in bytes), and a base type. The value column in the CSV file is the the size divided by the size of the base type. The value is usually 1, unless the field is a string or an array.

    See the Protocol definition for more information.
    developer.garmin.com/.../

  • I have a theory - need to do additional testing to validate, but would love for someone to confirm. I believe the value relates to the size of the field, but not in bytes (as is stored in byte 1 of a field definition in a .fit file). I believe this number is calculated as field.size / field.base_type.size. If I'm understanding correctly, a field can contain an array of values matching the base type defined for that field. So this number in the CSV file effectively represents the number of values to expect. In most cases, the value = 1, but some fields may contain multiple values, like 'left_power_phase' which contains the start and end angles in a single field.  

  • - Thank you! I didn't see your reply until after I posted. Very helpful. Thank you. 

  • What is the meaning of "Local Number"?

  • A FIT file contains message definitions and messages. The message definitions have a 4 bit id (0-15), and the header for each message contains a 4 bit value that indicates which message definition should be associated with this message. This is covered here: https://developer.garmin.com/fit/protocol/ 

    If you are trying to convert CSV files back to FIT files it does not matter what the value is, just use a value in the range of 0-15. Using 0 for all of them is fine. The encoder will keep track of the message definitions and assign them an id. In fact, if you are trying to convert CSV files back to FIT files, you can skip the message definitions all together. The encoder will create them for you based on the values in the messages.