Computed activity fields

If the number of activities is small, you can run the script from the setup of the custom field. That will calculate the field for that activity as I found out.
Something needs to trigger the recalculation…
But it’s not logical that gear usage adds up.

That shouldn’t happen. I just re-analysed by last 3 rides and it didn’t change the gear totals.

1 Like

Hi all and apologies for this apparently simple question:
I wanted to add an activity field for “work per distance” and used David’s “distance per stroke” as template.
My simple approach was like this

which doesn’t work. I guess it is a simple script/code/field error.

many thanks in advance
alfred

Is that what you want?

activity.icu_joules/activity.distance

All the available data of an activity is here.

1 Like

yes, thats exactly what I was after, not aware of the list…

many thanks
alfred

You can now map custom activity fields to fields in messages in activity FIT files. This is where summary information about the activity is stored. The field is automatically populated with data from the FIT file if it is present. The default behaviour is to look in the session record for a matching field name or number. However you can prefix the field name/number with the name/number of the record to search in other records.

This is what the session looks like on fitfileviewer.com.

You need to re-process existing activities after adding a field:

You can do this in bulk using the activity list view:

If set the FIT file session field name is also used when the field is written to a FIT file.

Examples of non-session record fields;

  • activity.total_timer_time
  • 140.4 (field number 4 of message number 140, Garmin Venu watch training effect times 10)

The script of the custom field can be used to transform the value once it has been read:

activity.isNew ? activity.TrainingEffect / 10 : activity.TrainingEffect

This expression only does this when the activity is new or its file is reprocessed otherwise it returns it as is.

If the field has multiple values you can use array index notation to extract the one you want:

avg_left_power_phase[2]

To get the 3rd value (first has index 0).

5 Likes

This is mind-blowing. I assume they should be on first level of the fit file. I mean, they are activity fields (like the final HR recovery of garmin or the running dynamics averages), not records fields that we can show per interval (like running dynamics stream), right?

Thank you once again.

Ok, I have to read better…

Mmm… What about fields without name? I mean, there are some hidden gems like recovery HR in the “field 202”, are they recoverable? I have try “202” or “filed202”, but I don’t know if this is possible.

I have added support for fields without names. Justify use the field number e.g. “202” instead of the name. I will deploy this on Monday AM.

3 Likes

Is it possible to access previous activity records, or previously calculated fields? eg to compare this activity to some previous record or index to give a quick indicator of better or worse than.

Not yet. I have that kind of thing planned for custom wellness fields. You can plot custom activity field on the /fitness page to see changes over time.

1 Like

That shouldn’t happen. I just re-analysed by last 3 rides and it didn’t change the gear totals.

It is happening to me for runs. I just reprocessed one activity and noticed that the default gear for it had added to it the activities distance. If there’s anything I can do to help debugging contact me, I can’t add screenshots now but will do it latter if it helps.

1 Like

You can now map custom activity fields to any message and field, not just session fields. The default behaviour is to look in the session record for a matching field name or number. However you can prefix the field name/number with the name/number of the record to search in other records.

Examples:

  • activity.total_timer_time
  • 140.4 (field number 4 of message number 140, Garmin Venu watch training effect times 10)

The script of the custom field can be used to transform the value once it has been read:

activity.isNew ? activity.TrainingEffect / 10 : activity.TrainingEffect

This expression only does this when the activity is new or its file is reprocessed otherwise it returns it as is.

3 Likes

This is truly amazing.

I’d like to check the final battery status or charge for my di2, HRM and PM. Is it possible to specify which you’d like and ensure it’s the last occurrence of that (I assume it creates a new device_info for each auto stop)?

-=EDIT=-

Though I did then find the activity.power_meter_battery which helps for that but still stuck on di2 & HRM

1 Like

I looked at one of my fit files and it looks like my eTap, Head Unit, QUARQ and Polar display some kind of battery status in device messages. Haven’t taken a closer look though.

Grouping those by DeviceID/Serial Mumber and taking the lowest would be great

I have a custom field set-up for Garmin’s VO2max estimate that seems to work sort-of but flips between the raw Fitfile data value and my derived, calculated value. On the Fitness page it plots only the raw value so I assume I have something not quite right somewhere? See screenshots below:

Just reverse the terms and be careful with upper/lower case and with field code spelling:

activity.isNew ? activity.VO2maxGarmin * 3.5 / 65536 : activity.VO2maxGarmin
3 Likes

EDIT: Figured it out. Speed is in m/s and need to convert to KMH by multiply 3.6

Help?
How come this either doesn’t work (wrong data/number) or doesn’t have data? (I did the Activty-Analyse)

All data in m/s can be automatically formatted as pace using the recent option added for that:

Or do you need especially km/h?