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
  • This is an awesome concept, thanks for creating this. I've read through the initial description posts and don't see this question answered, my apologies if I missed it.

    I'm using a CIQ1 device (Vivoactive) with Stryd. Is it possible with this app to display Power (W) fields in variations such as 3sec, 10sec, etc. And more importantly, is it possible using a CIQ1 to set an alert for a certain value on those fields?
  • badbri, thanks!

    Vivoactive (and Vivoactive HR) do not support power natively, regardless of CIQ support. Only Garmin's cycling computers and multisport watches support power natively, including: Edge, 920XT, Fenix, 735, 935 and D2 Bravo.

    The complete list is here:
    https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Activity/Info.html#currentPower-instance_method

    Since it isn't a native field, it isn't possible for AppBuilder to display it or to use it in a calculation.

    And no, the ALERT function is not available for CIQ1 devices, due to memory constraints.

  • Update 2.6.27
    CIQ2 only - New variables:
    userWeight (kg or lbs, per device settings)
    userWeight_raw (grams)
  • Update 2.6.28
    CIQ2/multisport/cycling only (Edge, Fenix 5/5S/5X, Fenix Chronos, 735XT, 935)

    New variables:
    frontGearIndex, frontGearMax, frontGearSize,
    rearGearIndex, rearGearMax, rearGearSize


    From the Garmin API docs:

    https://developer.garmin.com/downloa...nstance_method
    frontGearIndex:
    The current front bicycle derailleur index.
    Index values range from from 1 to the frontDerailleurMax.


    frontGearMax:
    The front bicycle derailleur maximum index.


    frontGearSize:
    The front bicycle derailleur gear size in number of teeth.


    https://developer.garmin.com/downloa...nstance_method
  • Update 2.6.29

    CIQ2 only: Added variable DistanceToLapStart. (Distance "as the crow flies", based on GPS position). Similar to DistanceToStart, but lap-based.

    During lap 1, this is the distance to the start of the activity.
    For all other laps, this is the distance to the start of the current lap.
  • Added a few examples based on interesting user requests. As usual, please replace square brackets with round brackets, because the forum is still broken.

    * Rest Timer
    Count up from 0:00 every time the activity is paused; e.g. workout rest intervals
    Formula: ElapsedTime - MAX(ElapsedTime)
    Display Format: Time

    (This works because MAX() only considers data while the activity is not paused.)

    * Rest Timer (Countdown) e.g. 60 second countdown
    Formula: 60 - (ElapsedTime - MAX(ElapsedTime))

    * Rest Timer (Countdown, with alert) e.g. 60 second countdown [CIQ2 devices only]
    Formula: ALERT[[60 - [ElapsedTime - MAX[ElapsedTime]] lte 0]] ; 60 - (ElapsedTime - MAX(ElapsedTime))

    * Work Timer
    Count up from 0:00 every time the activity is unpaused; e.g. workout active intervals
    Formula: Timer - MAX(if (PREV(timer) eq null, timer, null)) plus 1
    Display Format: Time

    Explanation:
    PREV(X): returns the previous sample of X [from one second ago], but only if the watch is not paused
    MAX(if (PREV(timer) eq null, timer, null)): The timer value at the first second after the watch is unpaused
  • Hi, could you please help me as I am a novice for this program language?

    I?m trying to calculate the following ratios:

    Normalized Power / Average Power using NP / AvgPower

    Normalized Power lap / Average Power lap using NP Lap/ AvgPower Lap

    Garimin F935 is giving the message "!Name"

    I know this is quite simple, but I have no idea about it. Thanks in advance
  • Hi, unfortunately Garmin's normalized power is not available to apps through the Garmin SDK, and therefore not available through AppBuilder. Please refer to the docs for available variables:
    https://forums.garmin.com/forum/deve...31#post1227731

    However, you can try to calculate it on your own. My understanding of normalized power is that it's calculated as follows:

    1) Take each of the power values for the last 30 seconds and raise them to the 4th power
    2) Take the average (over 30 seconds) of the number obtained in step 1.
    3) Take the 4th root of the number obtained in step 2. In other words, raise 2) to the power of 0.25.


    Maybe this will work for you
    TIMEAVG(Power ^ 4, 30) ^ 0.25

    ^ Note that this formula will ignore zeroes
    If you want a formula that does not ignore 0s, use TIMEAVG0:
    TIMEAVG0(Power ^ 4, 30) ^ 0.25

    My understanding is the native Garmin average power will not ignore zeroes. You might care about this if you ever coast down hills (my understanding is your power is zero at that point.) So you may wish to avoid AvgPower (which uses the native Garmin average power value) and use the AppBuilder AVG or AVG0 functions to control whether zeroes are considered or not.

    Your power ratio formula would either be:
    - Ignoring zeros
    TIMEAVG(Power ^ 4, 30) ^ 0.25 / AVG(Power)

    - Not ignoring zeroes
    TIMEAVG0(Power ^ 4, 30) ^ 0.25 / AVG0(Power)

    I guess the lap formulas would be:
    LAPAVG(TIMEAVG(Power ^ 4, 30) ^ 0.25) / LAPAVG(Power)
    or
    LAPAVG0(TIMEAVG0(Power ^ 4, 30) ^ 0.25) / LAPAVG0(Power)

    Hopefully I understood the problem correctly.
  • Dear FlowState,

    Thanks a lot for the help. I have tasted both formulas and the Lap formula is working perfectly (LAPAVG(TIMEAVG(Power ^ 4, 30) ^ 0.25) / LAPAVG(Power)). But the formula for the entire activity is no good, I guess because it is based on the last 30 seconds and due it changes all the time.
    Once NP can be calculated by the following formula:

    Average NP = IF * FTP

    Would be correct use this formula for the entire activity calculation?

    IF * FTP / AVG(Power)
    Again, could you help me with the correct mnemonics? Also, is there available a mnemonic list?
    Thanks in advance
  • The entire documentation for AppBuilder is in the following linked post. All variables and functions are described there.
    https://forums.garmin.com/forum/developers/connect-iq/connect-iq-showcase/1227689-data-field-appbuilder?p=1227731#post1227731

    Now that you have the function for "instant normalized power", you can take that and use the AVG function to get the average value for the entire activity.

    Ignoring zeroes:
    AVG(TIMEAVG(Power ^ 4, 30) ^ 0.25) / AVG(Power)

    Not ignoring zeroes:
    AVG0(TIMEAVG0(Power ^ 4, 30) ^ 0.25) / AVG0(Power)