Data Field: AppBuilder

By user request, this app lets you define your own data field, based on a simple math formula like cadence / 2.

If you want to get fancy, there's conditional expressions (like IF in Excel), functions for data analysis (like MIN and AVG), and the data field can also display the text of your choice. The resulting data can be (optionally) written to the activity FIT file.

With AppBuilder, you can implement almost any field that involves math, such as: calculating normalized power and saving the data to the FIT activity file, showing the average pace for even-numbered laps, or recording the amount of time you sprinted.

Full documentation and examples here:
http://ciq-appbuilder.blogspot.com/

AppBuilder 5:
Now with new features! AppBuilder 5 is a completely new app, so please check it out in the store if you are interested in any of the new features.
https://apps.garmin.com/en-US/apps/fd690281-9c22-4fee-a81e-3b7f39aa67c5

- Store up to four formulas per app. Switch between formulas directly on the watch, without using a phone or PC. With four clone apps, you can store up to 16 formulas total
- User variables. Allows for powerful formulas where information can be stored at one point, like the start of a lap, and used later. e.g. Lap elevation change
- Improved timeavg() options. Allows for simpler, more flexible normalized power function
- More functions and variables

4 clones of AppBuilder are available in the store, so you can have 2 formulas in the same activity
  • 2.6.4:

    - Modern devices: Add WHEN[] function, which lets you count # of sprints [for example]

    WHEN[cond, inThreshold, outThreshold]

    WHEN[cond] returns 1 every time a state is entered [0 otherwise]:

    cond: The condition which defines the state. e.g. Speed GT 16

    inThreshold: [optional] The number of seconds cond has to be true to enter the state. Default: 5. Minimum: 1
    outThreshold: [optional] The number of seconds cond has to be false to exit the state. Default: 5. Minimum: 1

    Example: # of times you sprinted [ran faster than 16 km/h, assuming device speed unit is km]:

    SUM[WHEN[Speed GT 16]]

    [I know the function name is terrible. Open to any suggestions for something better. Also open to any suggestions for a better way to avoid entering and exiting a state too often.]


    - All devices: Fix recent issue where "null" [in a formula] was treated as 0
  • I know the function name is terrible. Open to any suggestions for something better.


    In Excel there is slightly higher level function is known as COUNTIF[...], which is the same as SUM[WHEN[...]]

    Alternatively the mathematical name is cardinality, so you could call it CARDIF[...], although that looks like a mis-spelt Welsh town.
  • Unfortunately that's not the same thing. SUM[condition] is the same as COUNTIF[] or CARDIF[], assuming condition is 1 or 0. (In AppBuilder, the result of logical operators/functions is 1 or 0.)

    WHEN[] tracks when things become true [when a state is entered], not when they are true all the time.

    e.g.
    Speed GT 16 equals 1 any time you are running faster than 16 kph
    WHEN[Speed GT 16] equals 1 only at the instant that you start running faster than 16 kph

    So:
    SUM[Speed GT 16] = number of seconds sprinting [because the formula is eval'd once per second]
    SUM[WHEN[Speed GT 16]] = number of sprints

    inThreshold and outThreshold are there to prevent detecting too many changes. In the above example, if your speed is fluctuating between fifteen point nine and sixteen point one km per h, you don't want that to be counted as multiple sprints. (Counting the number of seconds sprinting is straightforward, but not the number of sprints, because what constitutes a "single sprint"?)

    (The forum doesn't like numbers, either).

    By default you would have to sprint for 5 seconds to enter the "sprinting state" (at which point the WHEN would be equal to 1 once, and SUM would go up by 1.) You would have to stop sprinting for 5 seconds to exit the sprinting state, as well. The flaw with this is that if you sprint on and off for 5 seconds at a time [which seems unlikely], that will be considered one long continuous sprint.

    I was thinking of calling WHEN[]: ON[], TRANSITION[], TRIGGER[], STATEON[], CHANGE[] or ONSTART[], but none of those things seem to make sense either. I'm not even sure that the current criteria for entering and exiting a state really makes sense. I was thinking about applying some sort of debouncing, but that doesn't seem right either.

    Maybe IFSTATECHANGE[] or IFCHANGE[] would've made more sense. I dunno...
  • Also, I am thinking of adding a few notification options when a state is entered/exited, such as:
    - Beep
    - Backlight
    - Vibe

    But that will require some testing.

    Another possible name for WHEN[], in that case: ALERT[].

    Something else I originally considered for WHEN(): have one condition for entering the state and a different condition for exiting.
    WHEN(enterCond, exitCond)
    Sprinting would be WHEN(speed GT 16, speed LT 15.5)

    But I decided that would be too confusing, and didn't really make sense, either.
  • 2.6.5 Add optional vibration/beep alerts to the WHEN[] function. [Should've called it ALERT[]]

    WHEN[condition, [inThreshold], [outThreshold], [inNotify], [outNotify]]
    inNotify: action to take when you enter the state described by condition [e.g. sprinting: Speed GT 16]
    outNotify: action to take when you exit the state

    actions:
    0 - none [default]
    1 - Beep/vibrate (i.e. Use device settings)
    2 - Beep (if supported/enabled)
    3 - Vibrate (if supported/enabled)

    e.g. Count sprints. Beep and vibrate when starting/stopping
    SUM[WHEN[Speed GT 16, 0, 0, 1, 1]]
    e.g. Count sprints. Vibrate when starting
    SUM[WHEN[Speed GT 16, 0, 0, 3]]
  • Please consider to add color changing on condition pleaaaaase !!!!
  • That's a cool idea, but unfortunately it just isn't possible with this kind of app (simple data field). If there were enough interest, maybe someday a "complex data field" version of this app could be written, where the appearance of the data field could be changed. That would probably only be feasible on modern watches, though. Older watches are already very close to the memory limit, unless I were to take stuff out.

    Or maybe in the future, Garmin will make changing the colour possible for a simple data field. There's already a request for this which was noted by Garmin.
  • 2.6.6: Modern devices: add distanceToStart variable.

    e.g. Estimated time to start:
    distanceToStart_raw / avgSpeed_raw
  • 2.6.7: If formula result is blank/null, display "--" instead of blank.
  • 2.6.8: Older devices: add lap metrics: lapDistance, lapTime, lapCount, LAPMIN(), LAPMAX()