Examples

AppBuilder can do a lot of different things, so here's a couple of example formulas to get you started.

Tap or click to copy a formula to the clipboard.

Notes

[LargeMemory] This appears next to any examples that only work on devices with large memory: All Edges (except 130 and 520), 645 Music, Fenix 5X and Fenix 5+ (all variants)
[CIQ2] This appears next to any examples that only work on modern devices. Older CIQ1 devices are not supported: FR230/235, FR630, FR920XT, Vivoactive, Fenix 3 (hr), D2 Bravo
[CIQ1] Appears next to examples that only apply to CIQ1, because there's an easier or better way to do it with CIQ2.
[AppBuilder5] This appears next to any examples that only apply to AppBuilder 5, and not AppBuilder Classic
[AppBuilderClassic] Appears next to examples that only apply to AppBuilder Classic

[avg] For AppBuilder Classic only: avg, lapavg and timeavg functions ignore zeros. Use avg0, lapavg0 and timeavg0 to consider zeros.
AppBuilder 5 avg functions consider zeros. To ignore zeros in AppBuilder 5, use avg(nonzero(x))

Any reference to Power only works with multisport watches (e.g. 935, Fenix 5) or Edge cycling computers
Power works with Stryd running pods if you connect to the Stryd as a generic power meter, on a multisport watch.
Power does not work with Garmin Running Power (which requires its own app), or a Stryd not connected as a generic power meter.
  • 1 foot cadence cadence / 2
  • [AppBuilderClassic] speed (5 second average)
    (including zeroes) timeavg0(speed, 5)

    (not including zeroes) timeavg(speed, 5)
  • [AppBuilder5] speed (5 second average)
    (including zeroes) timeavg(speed, 5)

    (not including zeroes) timeavg(nonzero(speed), 5)
  • Pace (5 second avg) [avg] timeavg(speed, 5)
    (Set Display Format to "Pace")
  • Power (5 second avg) [avg] timeavg(power, 5)
  • Displays the last time the activity was unpaused max(if (prev(timer) eq null, timer, null))
  • Display 20-minute countdown that resets on pause max(if (prev(timer) eq null, timer, null)) + 1200 - timer
  • Display text [AppBuilder5] [CIQ2] 'Run Happy'
  • Display a suffix [AppBuilder5] [CIQ2] hr + ' bpm'
  • Display two values [AppBuilder5] [CIQ2]
    hr + ':' + max(hr)
  • Display two values, record one [AppBuilder5] [CIQ2]
    record(hr) + ':' + max(hr)
  • Record different data to lap, summary and activity [AppBuilder5] [CIQ2]
    recordlap( lapavg(hr) ) ; recordsummary( max(hr) ) ; record(hr)
    (Displays current hr)
  • Display three values (current, average, max hr) [AppBuilder5] [CIQ2]
    hr + '/' + avg(hr) + '/' + max(hr)
  • Display three values (current, average, max hr); Record current, lap and average to fit [AppBuilder5] [CIQ2]
    recordlap(lapavg(hr)) ; record(hr) + '/' + recordsummary(avg(hr)) + '/' + max(hr)
  • Display Pace and hr and the same field [AppBuilder5] [CIQ2]
    formatpace(speed) + ':' + formatnumber(hr)
  • Freely format numbers (one decimal place) [AppBuilder5] [CIQ2]
    format(avg(hr), '%.1f')
  • Record number, and format it freely [AppBuilder5] [CIQ2]
    format(record(avg(hr)), '%.1f')
  • Yacht race timer [CIQ2]
    (five minute pre-race: display pre-race countdown, alert every minute, and alert with 10, 5 and 1 second left)
    (during race: display speed in knots)
    alert(timer gte 60); alert(timer gte 120); alert(timer gte 180); alert(timer gte 240); alert(timer gte 290); alert(timer gte 295); alert(timer gte 299); if (timer lte 300, 300 - timer, timeavg(speed_raw, 10) * 1.94384)
  • Elevation/altitude change totalascent - totaldescent
  • Distance to next milestone (every 5 km/mi) 5 - distance mod 5
  • Distance (km or miles, depending on device settings) distance
  • Distance (metres) distance_raw
  • Distance (km) distance_raw / 1000
  • Distance (miles) distance_raw / 1000 / kmPerMile
  • Speed (in km/h or miles/h, depending on device settings) speed
  • Speed (metres/s) speed_raw
  • Speed (km/h) speed_raw * 3.6
    (Use Pace display format for mm:ss per km)
  • Speed (miles/h) speed_raw * 3.6 / kmPerMile
    (Use Pace display format for mm:ss per mile)
  • Max altitude/elevation max(altitude)
  • Minimum hr min(hr)
  • Lap max hr lapmax(hr)
  • # of phone notifications notificationCount
  • Max pace maxspeed
    Display format: Pace (converts speed to pace)
  • Time spent waiting at red lights, with watch paused elapsedTime - timer
  • Average stride length (in metres) avgspeed_raw / cadence * 60
  • Avg stride length (in feet) avgspeed_raw / cadence * 60 / metresPerFoot
  • Alternate between min hr (displayed with a "-" prefix) and max hr, every 5 seconds
    if (timer mod 10 lt 5, -min(hr), maxHR)
  • Distance to next aid station at 5, 12.5, 17, (km or miles, per device settings)
    findlte(distance, 5, 12.5, 17) - distance
  • Display speed only if gps fix is good
    if(locationAccuracy eq 4, speed, null)
  • Stride length (based 10 second average speed) (in metres) [avg]
    timeavg(speed_raw, 10) / cadence * 60
  • Vertical speed (instantaneous)
    (altitude - prev(altitude)) / (timer - prev(timer))
  • Vertical speed (15 second avg) [avg]
    timeavg((altitude - prev(altitude)) / (timer - prev(timer)),15)
  • Moving time (faster than 2 mph = 0.89408 m/s)
    sum(speed_raw gt 0.89408)
    Display Format: Time
  • 10 minute countdown if (timer gt 10*60, 0, 10*60 - timer)
    (Display format: Time)
  • Alert at aid stations and show distance to next aid station [CIQ2]
    alert(distance gte 5); alert(distance gte 12.5); alert(distance gte 17); findlte(distance, 5, 12.5, 17) - distance
  • Alert every 5 km/mi [CIQ2]
    alert(distance gte 5 and distance mod 5 lte 0.1)
  • Alert every 1k, for the first 5k [CIQ2]
    alert(distance gte 1 and distance lte 5.1 and distance mod 1 lte 0.1)
  • Show 10 min countdown and beep/vibrate when it's over [CIQ2]
    alert(timer gte 10*60); 10*60 - timer
  • Show 10 min countdown; beep/vibrate and display 0 when it's over [CIQ2]
    alert(timer gte 10*60); if (timer gt 10*60, 0, 10*60 - timer)
  • Distance to start [CIQ2] distanceToStart
  • Estimated time to start [CIQ2] distanceToStart_raw / avgspeed_raw
  • Workout pace: Average speed/pace for even numbered laps [avg]
    avg(if (lapCount mod 2 eq 0, speed, null))
  • Time spent sprinting (faster than 16 km/h), assuming device speed units = km
    sum(speed gt 16)
    (Set Display Format to "Time")
  • Time spent sprinting (faster than 5 m/s)
    sum(speed_raw gt 5)
    (Set Display Format to "Time")
  • Count sprints [CIQ2]
    sum(when(speed_raw gt 5))
  • Count sprints longer than 30 seconds. [CIQ2]
    sum(when(speed_raw gt 5, 30))
  • Count sprints. Beep and vibrate when starting/stopping [CIQ2]
    sum(when(speed_raw gt 5, 0, 0, 1, 1))
  • Count sprints. Vibrate when starting [CIQ2]
    sum(when(speed_raw gt 5, 0, 0, 3))
  • Lap ascent totalascent - lapmin(totalascent)
  • Lap descent totaldescent - lapmin(totaldescent)
  • Lap Elevation Change I
    totalascent - lapmin(totalascent) - (totaldescent - lapmin(totaldescent))
    (based on Total ascent and Total descent, which are filtered by Garmin)
  • Lap Elevation Change II [AppBuilder5] [CIQ1]
    setv(if (prev(timer_raw, 2) eq 0 or prev(lapCount,2) lt lapCount, 1, null), altitude) ; getv(1) - altitude
    (based on altitude change)
  • Lap Elevation Change II [AppBuilder5] [CIQ2]
    lapstart(altitude) - altitude
    (based on altitude change)
  • Rest timer (count up from 0:00 every time activity paused; e.g. workout rest intervals)
    elapsedtime - max(elapsedtime)
    Display Format: Time
    (max only considers data while activity not paused.)
  • Work timer (count up from 0:00 every time the activity is unpaused; e.g. workout active intervals)
    timer - max(if (prev(timer) eq null, timer, null)) plus 1
    Display Format: Time
    (prev(x): returns previous sample of x (from 1 second ago), but only if watch is not paused
    max(if (prev(timer) eq null, timer, null)): The timer at first second after watch is unpaused)
  • Time of day (24-hour clock) timeofday
    Display Format: Time
  • Time of day (24-hour clock), no seconds timeofday div 60
    Display Format: Time
  • ETA for marathon, based on 60s average speed (distance/speed units = any)
    timeofday plus (42195 - distance_raw) / timeavg(speed_raw, 60)
    Display Format: Time
  • ETA for marathon, based on 60s average speed (distance/speed units = any), omit seconds
    (timeofday plus (42195 - distance_raw) / timeavg(speed_raw, 60)) div 60
    Display Format: Time
  • Pace in seconds per km 1 / speed_raw * 1000
  • Pace in s per km/mi, as per device speed settings 1 / speed * 3600
    Note: with Pace in s per km/mi, use Time display format for mm:ss. With speed in km/h or mi/h, use Pace format for mm:ss.
  • [avg] Average cadenceavg(cadence)
  • avg cadence, not including any values below 10 avg(if(cadence gte 10, cadence, null))
  • 5 second countdown with beep/vibration alert. Repeats indefinitely. [CIQ2]
    alert(timer gte 5 and round(timer) mod 5 gte 0 and round(timer) mod 5 lte 2) ; 5 - (round(timer) mod 5)
    Display Format: Time
    (Normally rounding of intermediate results is unnecessary, but for a short countdown, it makes sense.)
  • distance faster than 7:30 pace (per km/mi, per settings)
    sum( if ( 1 / speed * 3600 lte 7 * 60 + 30, distance - prev(distance), 0 ) )
  • Remaining distance to 5 mi/km target above 7:30 pace per mi/km, per settings
    5 - sum( if ( 1 / speed * 3600 lte 7 * 60 + 30, distance - prev(distance), 0 ) )
  • Remaining distance to 5 mi/km target above 7:30 pace per mi/km, and alert when target is reached: [AppBuilder5] [CIQ2]
    setv(1, 5 - sum(if (1 / speed * 3600 lte 7 * 60 + 30, distance - prev(distance), 0))) ; alert(getv(1) lte 0) ; getv(1)
  • Normalized Power [AppBuilder5] [CIQ2]
    Normalized Power (native): Activity average
    avg(timeavg(power,30,1)^4)^0.25

    Lap np (native): Carries the rolling average over from previous lap
    lapavg(timeavg(power,30,1)^4)^0.25

    Lap np: Resets at start of each lap
    lapavg(ifs(lapTime gte 30,timeavg(power,30,1)^4))^0.25
  • Normalized Power [AppBuilder5] [CIQ1]
    Normalized Power (native): Activity average
    avg(ifs(timer gte 30 and (timer - max(ifs (prev(timer) eq null, timer)) plus 1) gte 30, timeavg(power,30)^4))^0.25

    Lap np (native): Carries the rolling average over from previous lap
    lapavg(ifs(timer gte 30 and (timer - max(ifs (prev(timer) eq null, timer)) plus 1) gte 30, timeavg(power,30)^4))^0.25

    Lap np: Resets at start of each lap
    lapavg(ifs(lapTime gte 30 and (timer - max(ifs (prev(timer) eq null, timer)) plus 1) gte 30, timeavg(power,30)^4))^0.25

    These behave like native fields, except in the case of when the activity is paused and unpaused. With these formulas, when the activity is unpaused, the np or Lap np will not be updated until a full 30 seconds has passed (to obtain enough samples for a rolling average)

    Explanation:
    timer gte 30: Wait 30 seconds from the start of the activity before considering data for the overall average
    LapTime gte 30: Wait 30 seconds from the start of the lap before considering data
    max(ifs (prev(timer) eq null, timer)) plus 1) gte 30: Wait 30 seconds from the last time the activity was unpaused before considering data
  • Intensity Factor [AppBuilder5] [CIQ2]
    Substitute your FTP for YOUR_FTP
    avg(timeavg(power,30,1)^4)^0.25 / YOUR_FTP
  • Intensity Factor [AppBuilder5] [CIQ1]
    Substitute your FTP for YOUR_FTP
    avg(ifs(timer gte 30 and (timer - max(ifs (prev(timer) eq null, timer)) plus 1) gte 30, timeavg(power,30)^4))^0.25 / YOUR_FTP
  • HR Zone (whole number/integer)
    findlteindex(hr+1, UserHRZone1Min, UserHRZone1max, UserHRZone2max, UserHRZone3max, UserHRZone4max, UserHRZone5max+1, 220+1)
  • Heart Rate Zone (fractional) [AppBuilder5]
    setv(1, findgte(hr, UserHRZone5max+1, UserHRZone4max, UserHRZone3max, UserHRZone2max, UserHRZone1max, UserHRZone1Min, 35)) ; findltindex(hr, UserHRZone1Min, UserHRZone1max, UserHRZone2max, UserHRZone3max, UserHRZone4max, UserHRZone5max+1, 220+1) + (hr - getv(1)) / (findlt(hr, UserHRZone1Min, UserHRZone1max, UserHRZone2max, UserHRZone3max, UserHRZone4max, UserHRZone5max+1, 220+1) - getv(1))
    This example is too complex for ciq 1 devices, although all the functions are technically supported
  • Heart Rate Zone (fractional) [AppBuilderClassic]
    findlteindex(hr+1, UserHRZone1Min, UserHRZone1max, UserHRZone2max, UserHRZone3max, UserHRZone4max, UserHRZone5max+1, 220+1) + (hr - findgte(hr, UserHRZone5max+1, UserHRZone4max, UserHRZone3max, UserHRZone2max, UserHRZone1max, UserHRZone1Min, 35)) / (findlte(hr+1, UserHRZone1Min, UserHRZone1max, UserHRZone2max, UserHRZone3max, UserHRZone4max, UserHRZone5max+1, 220+1) - findgte(hr, UserHRZone5max+1, UserHRZone4max, UserHRZone3max, UserHRZone2max, UserHRZone1max, UserHRZone1Min, 35))
    Basically: HR_fractional_zone = HR_integer_zone + (hr - HR_zone_min) / (Hr_zone_max - HR_zone_min)
    Garmin seems to use 35 as the minimum for "zone 0"
    More detailed explanation
    This example is too complex for ciq 1 devices, although all the functions are technically supported
  • Approximate rolling average (good for large samples) [AppBuilder5]
    setv(1, if (getv(1) eq null, 0, getv(1) - getv(1) / n + alt(x, 0) / n))
    x: quantity/formula to average
    n: number of samples (seconds)
    This is an exponentially weighted average (not quite the same as a moving average), but it doesn't need to store all the data, so it works with large samples (e.g. 20 minute power)
    alt(x, 0): Has the effect of treating a null/blank x as 0, so the formula doesn't reset the average if x is null.
    Source
  • Approximate 20 minute power [AppBuilder5]
    setv(1, if (getv(1) eq null, 0, getv(1) - getv(1) / 1200 + alt(power, 0) / 1200))
  • Approximate FTP [AppBuilder5]
    setv(1, if (getv(1) eq null, 0, getv(1) - getv(1) / 1200 + alt(power, 0) / 1200)) ; max(getv(1)) * 0.95
  • 20 minute power (newer Edges and Fenix 5+) [AppBuilder5]
    timeavg(power,1200,1)
    1200 samples takes a lot of memory, so this won't work on most devices. Note that nothing will be displayed until 20 minutes have passed.
  • 20 minute power (show average even before 20 minutes) (newer Edges and Fenix 5+) [AppBuilder5]
    timeavg(power,1200,0)
  • FTP (newer Edges and Fenix 5+) [AppBuilder5]
    max(timeavg(power,1200,1)) * 0.95
  • FTP (display 20-minute countdown) (newer Edges and Fenix 5+) [AppBuilder5]
    alt(max(timeavg(power,1200,1)) * 0.95, formattime(max(if (prev(timer) eq null, timer, null)) + 1200 - timer))
    The countdown (and the ftp calculations) reset whenever you pause the activity.
  • Save/Display elevation at beginning of activity [AppBuilder5] [CIQ1]
    setv(if (prev(timer_raw, 2) eq 0, 1, null), altitude) ; getv(1)
  • Save/Display elevation at beginning of activity [AppBuilder5] [CIQ2]
    start(altitude)
  • Save/Display elevation at beginning of lap [AppBuilder5] [CIQ1]
    setv(if (prev(timer_raw, 2) eq 0 or prev(lapCount, 2) lt lapcount, 1, null), altitude) ; getv(1)
  • Save/Display elevation at beginning of lap [AppBuilder5] [CIQ2]
    lapstart(altitude)
  • Power Zone [AppBuilder5]
    setv(1, findgte(power, 240, 210, 180, 150, 110, 50, 0)) ; findltindex(power, 50, 110, 150, 180, 210, 240, 300) + (Power - getv(1)) / (findlt(power, 50, 110, 150, 180, 210, 240, 300) - getv(1))
    Assuming your zones are:
    0 to 50
    50 to 110
    110 to 150
    150 to 180
    180 to 210
    210 to 240
    240 to 300

    Adjust as necessary for your actual power zones.

    iow: Fractional Power Zone = Integer Power Zone + (Power - Zone Min) / (Zone max - Zone Min)
  • Strength activity set counter
    lapcount div 2 + 1
  • Lap calories [Appbuilder5] [CIQ1]
    setv(if (prev(timer_raw, 2) eq 0 or prev(lapcount, 2) lt lapcount, 1, null), calories) ; calories - getv(1)
  • Last Lap Average hr [AppBuilder5] [CIQ1]
    setv(if (prev(lapCount, 2) lt lapcount, 1, null), prev(lapavg(hr), 2)) ; getv(1)
  • Lap calories [Appbuilder5] [CIQ2]
    calories - lapstart(calories)
  • Last Lap Average HR [Appbuilder5] [CIQ2]
    lastlap(lapavg(hr))
  • Last Lap calories [Appbuilder5] [CIQ2]
    lastlap(calories - lapstart(calories))
  • Last Lap Time [Appbuilder5] [CIQ2]
    lastlap(laptime)
  • Last Lap Total Time [Appbuilder5] [CIQ2]
    lastlap(timer)
  • Lap Speed (in km/h or miles/h, as per device unit settings) lapdistance / laptime * 3600
    Speed = distance / time
    lapDistance is in km or miles (as per settings)
    lapTime is in seconds
    There are 3600 seconds in one hour, which is why you multiply by 3600.
  • Lap Pace lapdistance / laptime * 3600
    Set Display Format to Pace
  • Last Lap Speed [Appbuilder5] [CIQ2] lastlap(lapdistance / laptime * 3600)
  • Last Lap Pace [Appbuilder5] [CIQ2] lastlap(lapdistance / laptime * 3600)
    Set Display Format to Pace
  • Lap Speed (in metres/second) lapdistance_raw / laptime
  • Average power, 3 decimal places [Appbuilder5] [CIQ2]
    formatdecimal(avg(power), 3)
  • Moving speed (miles or km/h, per device unit settings)
    distance / sum(speed_raw gt 0.89408) * 3600
  • Moving pace (minutes per mile/km)
    distance / sum(speed_raw gt 0.89408) * 3600
    Display Format: Pace
  • Elevation grade (rough estimate over last 50 metres) [AppBuilderClassic] [CIQ2]
    (altitude_raw - prevd(altitude_raw, 50)) / (distance_raw - prevd(distance_raw, 50)) * 100
  • Elevation grade (much better estimate) [AppBuilder5] [CIQ2]
    IF(Speed_raw GTE 1, TIMEAVG((Altitude_raw - PREVN(Altitude_raw, 14)) / (Distance_raw - PREVN(Distance_raw, 14)) *100, 3), 0)
  • Record Power so sites like Training Peaks, Stryd and Smashrun recognize it [AppBuilder5] [CIQ2]
    record(power, 7, "Power")
  • Time for last 5K [AppBuilder5] [LargeMemory]
    timer - prevd(timer, 5000, 5000, 1)

Comments

  1. Cant seem to get this to work at all, have installed via connect iq and set formula, but wont work. I am trying to get mph in cycling mode. Do you need to do running mode as well?

    ReplyDelete
    Replies
    1. Hey, you don't need to do running mode, it will work in any mode. Not sure why it isn't working for you. Could you try a simple formula like Timer or Cadence / 2? Thanks.

      Delete
  2. Is there any formula for total rpm? There was the total pedaling strokes on Garmin Connect

    ReplyDelete
  3. Is there a way to display the time in the current interval, where the interval is defined by the speed being above some threshold (e.g. 4mph). In other words, I'd like to know how long ago the speed last was below 4mph.
    A follow-on question is whether there is a way to display the pace in the current interval. In other words, time-in-interval divided by distance-in-interval.
    Very cool and helpful app overall, plus good docs! Hats off! Thanks much!

    ReplyDelete
    Replies
    1. Thanks! I apologize for the incredibly late response, but you could try this for time in current interval:

      Formula: setv(0, if (speed lt 4, timer, null)); timer - getv(0)
      Display Format: Time

      For pace in current interval:

      Formula: setv(0, if (speed lt 4, timer, null)); setv(1, if (speed lt 4, distance, null)); (distance - getv(1)) / ((timer - getv(0)) / 3600)

      Display Format: Pace


      Note:
      - The above formulas assume that your watch's speed units are miles per hour. If you want a formula that would refer to "4 mph" regardless of speed unit settings, use "speed_raw lt 1.79" (4 mph = 1.79 m/s)

      Delete
  4. Hi, is there a formula for time or distance left on training workout step?

    ReplyDelete
    Replies
    1. Unfortunately that information isn't available to Connect IQ apps / data fields.

      Delete
  5. G'day! Is there a formula for displaying the total time spent ascending in an activity? So like Total moving time, but only when going uphill?

    ReplyDelete
  6. I'm a bit confused.

    I understand that Appbuilder enables a value to be calculated which is then displayed in a field on a GPS and I have used it in that way.

    Does the value displayed have to be the result of a single expression because you show some examples with several statements each separated by a semicolon. These examples tend to use the function "prev".

    If multiple statements are allowed, which one produces the value which is displayed?

    ReplyDelete
    Replies
    1. The final expression/statement in a comma-separated list is the one which produces the value to be displayed. The purpose of semicolons is to facilitate the use of functions which have side effects but whose value you don't necessarily want to display, like ALERT(), RECORD(), and SETV().

      Delete
    2. Sorry, "comma-separated list" should read "semicolon-separated list" in the above comment.

      Delete
  7. Is It possible to add a new lap according a formula result? Exempel: Every time that o change the course greather than 90 degress, in less than 5 seconds, the App add a new lap.

    ReplyDelete
    Replies
    1. No, Connect IQ data fields can't add new laps.

      Delete
  8. Is there a way to show what the next workout will be?

    ReplyDelete
    Replies
    1. No, that information isn't available to Connect IQ apps.

      Delete
  9. Is there a way to show the maximum power for the last lap in the Run Power datafield?
    Thanks.

    ReplyDelete
    Replies
    1. Will the Maximum power (5s average) of last lap be:

      max(timeavg(lastlap(power), 5)

      Delete
    2. I think you want:

      lastlap(max(timeavg(power, 5)))

      Delete
  10. I'd like to display the mode of my Varia RTL510 Rear Light on my Edge 130. Can I do this with AppBuilder? if so, what would the formula be? Many thanks in advance.

    ReplyDelete
    Replies
    1. Sorry, AppBuilder can't directly communicate with sensors.

      Delete
  11. Is it possible to add running efectiveness? RE [kg/N] = Speed [m/s] / Power [W/kg] Thank you

    ReplyDelete
    Replies
    1. Sure, you should be able to use the following formula:

      speed_raw / (power / (UserWeight_raw/1000))

      If are using an older watch such as FR235 which does not have UserWeight, then use this:

      speed_raw / (power / WEIGHT)

      where WEIGHT is just your manually entered weight in kg.
      I assuming you're using a Stryd, in which case you'll have to pair it as a power meter for AppBuilder to have access to power readings. If you're using Garmin Running Power it won't work.

      Delete
  12. Hello. Is there just a simple HR formula? Just discovered your app. Love how you've put examples...just copy and paste. Thank you

    ReplyDelete
  13. Hi staff, I'm used to look at the VAM (30sec) field.
    It's possible to have a new field that show the avarage VAM of current lap calculate only on the time I spent to climb (es: grade > 3%), excluding descent, plain, slight climbs (under 3%) and pauses.
    Thanks.

    ReplyDelete
    Replies
    1. I tried something like this...

      ***Vertical speed***
      setv (1, (altitude_raw - prevn (altitude_raw, 30)) * 120) ;

      ***check if I reached minimum grade and speed for at least 30 sec***
      setv (2, when (((speed_raw gt 1) and (altitude_raw - prevd (altitude_raw, 20)) gt 0.6), 30, 2)) ;

      record (timeavg (getv(1), 30)) ;
      recordsummary (avg (if (getv(2) eq 1, getv(1), null))) ;
      recordlap (lapavg (if (getv(2) eq 1, getv(1), null)))

      Delete
    2. Hi Riccardo,
      Did it worked? did you used another formula?
      I tried this one you posted here but it didn't work for me. I don't know what I am doing wrong
      Thanks!

      Delete
  14. Is there a formula for displaying TSS score?

    ReplyDelete
    Replies
    1. According to Training Peaks, the formula for TSS score is:
      https://www.trainingpeaks.com/blog/estimating-training-stress-score-tss/
      TSS = (sec x NP® x IF®)/(FTP x 3600) x 100

      In appbuilder this would be:

      timer * (avg(timeavg(power,30,1)^4)^0.25) * (avg(timeavg(power,30,1)^4)^0.25 / YOUR_FTP) / (YOUR_FTP * 3600) * 100

      Or in simpler terms:
      timer * avg(timeavg(power,30,1)^4)^0.5 / (YOUR_FTP^2 * 36)

      (Manually substitute your FTP for YOUR_FTP)

      Delete
  15. is there a formula to show: W 'BALANCE? thank you so much

    ReplyDelete
  16. I'd like to use this app to simply display the VMG in knots for nautical navigation, but what seemed like a simple idea, is proving to be quite challenging. The first solution would be to simply divide the VMG in km/h by 1.852 to convert, but apparently VMG is not available to the app. So, I thought about calculating the VMG from scratch, by multiplying the speed by the cosine of the difference between bearing and course, but... no cosine function is available as well. Any ideas?!

    ReplyDelete
    Replies
    1. Thanks for the interest in the app! As I said in reply to your comment on the Functions page:

      I can look into adding trig functions, but memory is pretty tight on many devices. If you have a current device which supports music and is *not* a Venu or Vivoactive, it should be doable.

      Which device do you have?

      Delete
  17. Hi!! is there a way to show in one field both the "distance remaining" and the "ascent remaning" from climb pro widget?
    Thanks a lot!!

    ReplyDelete
    Replies
    1. I would also like the "distance remaining" field to change to "distance remaining to next climb" wile I am not in the midle of a climb.
      Thanks again!!

      Delete
  18. Hi, can you please tell me if there is a formula for 10s power on the Edge 130 plus.
    Thanks in advance

    ReplyDelete
  19. Hi, thanks for this super tutorial and app... CIQ2 applies to Edge 530??

    ReplyDelete
  20. How can I set up Hourly Alert just one Beep signal ? from 7:00am to 23:00 pm

    ReplyDelete
  21. How can adjust my 3s power value? NOt sure how to make the formula.
    I understand "power * 1,1" for example, but how do I do the same for 3s power?

    And is it possible to overwrite the current power data (to fit file)?

    ReplyDelete
  22. Hi, is there a way to calculate number of steps during the activity?
    Is it possible to calculate rTSS and hrTSS?
    Thanks.

    ReplyDelete
    Replies
    1. Hi, I require my Fenix to Beep (not vibrate) each 500 kJoule (derived from avg power multiplied with seconds_elapsed...

      Delete
  23. Hi, I require my Fenix to Beep (not vibrate) each 500 kJoule (derived from avg power multiplied with seconds_elapsed... So far I did: "formatdecimal(((avg(power)*timer)/1000), 0)" and it works...

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Is this possible I'm getting !name error

      ifs(sum(speed_raw lte 0.89408), alert(timer gte 1*60); 1*60 - timer, sum(speed_raw gt 0.89408), elapsedTime)

      basically when below 2mph give me a 1min countdown, when moving faster show elapsed time

      Delete
  25. Hi This looks as though it might be exactly wha tI'm looking for! IF it can create a simple single temperature field to subtact 6 degrees F from the standard temp value on a Garmin 1030+ :-)
    IS there a way of doing that? THANK YOU! So simply displayed F -6 =

    ReplyDelete
  26. Hi, is there a formula for AVG stroke rate and distance per stroke?

    ReplyDelete
  27. Hi. i use Appbuilder 5+ (D) and i have my formula. but if i modify it using last version Garmin Connect on my phone not save it.
    I think also that my formula it's too long but before worked.
    Now if i want to modify it not save.
    This problem also with Garmin Express.
    I use Garmin Edge 520.
    What can i do for modify and save it ?
    thanks

    ReplyDelete
  28. Hi... Awesome app, is there a formula to display Time to Go , i see theres is a timer on the wourkout mode, i have a Edge 130 plus thanks

    ReplyDelete
  29. My open water swim tracks in yards until I hit 3 miles and it switches to miles. Wondering if there is a formula that would allow me keep tracking yards (maybe multiply the distance value times 1,760 yards) - won’t be relevant until the distance tracking flips to miles, but maybe that would work? Not really sure how to add these fields to my data screens yet, but hoping to sort that out - thank you!

    ReplyDelete
    Replies
    1. You could use the following formula to display distance in yards:
      distance_raw * 1.0936132983
      Or to keep it simple:
      distance_raw * 1.09361

      1) Use the Connect IQ mobile app to download AppBuilder 5 and sync it to your watch
      2) In your open water swim activity, add AppBuilder 5 as a custom data field. I don't know which watch you have, but here's a Garmin video which shows you how to do this on Fenix 7. (There will be a separate category for Connect IQ, when you select the data field to add.)
      https://www.youtube.com/watch?v=aRLwIR7umEc

      Delete
    2. Wow - that was a quick response! So, that formula converts meters to yards. Does that mean distance_raw always keeps a raw distance in meters (even if I am setup to not use metric) and doesn’t switch over to kilometers or miles at the three mile mark? I got it setup just like you described - great explanation. It is ready to test for my next swim. Thank you!

      Delete
    3. "Does that mean distance_raw always keeps a raw distance in meters (even if I am setup to not use metric)"

      Yep.

      All metrics support either automatic units (based on watch settings) or "raw" units (which are what's used internally by the Connect IQ API). The automatic units for a metric typically match what you'd see in the corresponding built-in data field. For example, "distance" is either km or miles (based on watch settings) and "distance_raw" is in metres.
      For detailed information on metrics and units, see:
      https://ciq-appbuilder.blogspot.com/p/variables.html

      Delete
  30. I am trying to use the formulas 'elapsedtime – max(elapsedtime)' & 'elapsedtime – timer' but the data screen has !NAME in both boxes. Any ideas what is wrong as I got these off the Ride Far Blog?

    ReplyDelete
    Replies
    1. Sorted, I went on to the AppBuilder page and used the Get Code/Validate formula and the problem was the hyphen which although copied from the Ride Far page was the wrong one. Once deleted and replaced works fine.

      Delete
    2. That's right. Technically, "–" is an en dash, which is not recognized by AppBuilder. AppBuilder only recognizes "-" (hyphen) for subtraction. I'm guessing that the blogger may have composed their post with Word, which sometimes replaces hyphens with en dashes.

      (Due to memory constraints on many devices, it's not really feasible for AppBuilder to recognize all sorts of alternate symbols like em dashes and en dashes.)

      Glad you got it sorted out!

      Delete
  31. Hi, I'd like to have an average speed datafield that excludes the first lap (riding out of the town) of the activity. It's a simple expression: Distance - 1st LapDistance / Timer - 1st LapTime, but I can't figure out how a distance/time for a specific lap can be referenced. Thanks!

    ReplyDelete
  32. Hi!!! Is there a formula to calculate the GAP (Grade Adjusted Pace)?Thanks in advance…

    ReplyDelete
    Replies
    1. Been playing around with this today. Using Strava's GAP model and a 5s smoothing it would be something like:

      setv(1, 100*(altitude_raw - prevn(altitude_raw, 5))/(distance_raw - prevn(distance_raw, 5)));
      (1+(0.030266*getv(1))+(0.0018814*getv(1)^2)+(-0.0000033882*getv(1)^3)+(-0.00000045704*getv(1)^4))*timeavg(speed,5)

      with the display format change to Pace

      Delete
  33. How do I reference %Heart rate reserve? I've attempted to reference the metric by HRR, %HRR and %Heart rate reserve with the following formula.

    (%heart rate reserve/((power/360*100)))

    Or something to this effect.

    Ideally I'd have:

    %HRR / ((3 Second Power/6 min max power)*100)

    This will give an idea of internal/external load in real time.

    ReplyDelete
  34. Could someone help with lap ave power in w/kg for an edge 520. All subsequent edge have this native. Thanks

    ReplyDelete
  35. Is there a way I can build a field for an indoor vertical climber for cadence/steps or cycles per minute or something like that?

    ReplyDelete
  36. Trying to figure out this field "Time(r) since stopped". When i start an activity the timer starts (counting up) but when my device is paused for more than 1 minute it resets to zero and starts again when I start moving again.

    ReplyDelete
  37. is there a way to only get the last X minues of activity? for instance I want to get the 3sec average power for the most recent 60 minutes only. Thanks for your help

    ReplyDelete
  38. Hello,
    I am on a Fenix 6X Pro Solar, the average vertical speed :
    timeavg((altitude - prev(altitude)) / (timer - prev(timer)),15)
    is not working (always shows 0, dispay format is "auto", i tried decimal but did not work either).
    I am not sure which version of AppBuiler it was but some years ago on a Forerunner 935 it was working fine.
    Can anyone help ?
    Thank you

    ReplyDelete
    Replies
    1. I found my pb… just need to multiply by 3600. Ooops…

      Delete
  39. Hi! I’m trying to put togheter a formula that displays 3 non related data: average moving speed / distance / time of the day ; the fist 2 are displaying correctly but no matter what I do the time of the day is either displaying only in seconds or only in minutes or only the whole hour (i’m using the div XXXX formula) I’d like to know if it is possible to display normally, with the seconds (HH:MM:SS)

    ReplyDelete
    Replies
    1. timeavg(speed, 5) + ' / ' + distance + ' / ' + format(timeofday div 3600 , '%.1f')

      like this

      Delete
    2. I have a edge 130 btw, all comente above are mine

      Delete
  40. Hello
    I am trying to add a data field for time remaining in a swim workout rep. For example the rep would be 100m on 2 minutes. I want to know the amount of time I have left in that step of the workout. Can this app do this calculation?

    ReplyDelete
  41. Can I add the total multisport distance for all different activities?
    Like the already present multisport time, but I need the total multisport distance.

    ReplyDelete
  42. This comment has been removed by the author.

    ReplyDelete
  43. I'd like to have my efficiency factor for cycling visible. It's just average power/average heart rate = effiency factor. Can someone please help me?

    ReplyDelete
    Replies
    1. Seems to be easy, something like timeavg(Power, 3) / timeavg(HR, 3) You can change average time according to your needs, and may want some rounding or decimal truncate on the result

      Delete
  44. Hi. Fabulous app. However one thing I wanted to display, but cannot see how to implement is the Moving Time for the current lap. Is this possible? Thanks

    ReplyDelete
    Replies
    1. Actually I have found a solution. The following works perfectly.
      sum(speed_raw gt 0.89408) - lapstart(sum(speed_raw gt 0.89408))

      Delete

Post a Comment