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
  • Former Member
    Former Member over 5 years ago
    If you want to avoid false values at start, you could also try:

    IF(Speed_raw GTE 1, TIMEAVG((Altitude_raw - PREVN(Altitude_raw, 14,1)) / (Distance_raw - PREVN(Distance_raw, 14,1)) *100, 3), 0)

    But it happens only for the first 14secs so not a big deal.
  • If you want to avoid false values at start, you could also try:

    IF(Speed_raw GTE 1, TIMEAVG((Altitude_raw - PREVN(Altitude_raw, 14,1)) / (Distance_raw - PREVN(Distance_raw, 14,1)) *100, 3), 0)

    But it happens only for the first 14secs so not a big deal.


    Hi Jth9,
    yes is not big problem these values false to start, becouse my training is about 2-3-4 hours with my road bike.
    Previous days i have change the 14 secs to 10 secs to align the sampling time with other calculated data (average speed).
    The final values slightly overestimated, but yesterday I recalibrated the formula and today i test all.
    thanks for info.
  • Hello, I'm trying to have a field with Lap NP, NP and IF. Here is the formula I've used:

    lapavg(timeavg(power,30,1)^4)^0.25 + ‘/’ + avg(timeavg(power,30,1)^4)^0.25 + ‘/’ + avg(timeavg(power,30,1)^4)^0.25 / 301

    But the IF shows as 1, no decimals. So I tried the following change:

    lapavg(timeavg(power,30,1)^4)^0.25 + ‘/’ + avg(timeavg(power,30,1)^4)^0.25 + ‘/’ + formatdecimal(avg(timeavg(power,30,1)^4)^0.25 / 301, 2)

    But appears something like !Name. Where is the error in the formula?

    Thanks
  • CorrerUnaMaraton Hey, you've got "smart quotes/apostrophes" in your formula, which don't work in AppBuilder. (I actually tried to add support once, but it slowed down the formula processing too much, and the app would crash.) Anyway, in coding, smart quotes usually aren't accepted anyway. You need to use normal quotes.

    Smart quotes are curly:
    ‘ ’ “ ”
    Normal quotes are straight:
    ' "
    Try this instead:
    lapavg(timeavg(power,30,1)^4)^0.25 + '/' + avg(timeavg(power,30,1)^4)^0.25 + '/' + formatdecimal(avg(timeavg(power,30,1)^4)^0.25 / 301, 2)


    In the future:
    - You can use the AppBuilder "formula-to-code" web app to validate your formula: https://ciq-appbuilder.blogspot.com/p/5plus.html
    It will tell you (roughly) what part of the formula is invalid. (Although this might need a bit of work on my part.)
    - If you are using a phone/tablet to type in your formula, hold down the quote key to get normal quotes
    - On iOS you can turn off smart punctuation like so: https://www.howtogeek.com/344310/how...hone-and-ipad/

    If you are typing the formula in on PC/Mac:
    - Don't use an app like Word/Pages, that's designed to make documents that look nice for people .Use a "plain text editor" like Notepad/TextEdit, that's okay for code.
  • CorrerUnaMaraton Hey, you've got "smart quotes/apostrophes" in your formula, which don't work in AppBuilder. (I actually tried to add support once, but it slowed down the formula processing too much, and the app would crash.) Anyway, in coding, smart quotes usually aren't accepted anyway. You need to use normal quotes.

    Smart quotes are curly:
    ‘ ’ “ ”
    Normal quotes are straight:
    ' "
    Try this instead:
    lapavg(timeavg(power,30,1)^4)^0.25 + '/' + avg(timeavg(power,30,1)^4)^0.25 + '/' + formatdecimal(avg(timeavg(power,30,1)^4)^0.25 / 301, 2)


    In the future:
    - You can use the AppBuilder "formula-to-code" web app to validate your formula: https://ciq-appbuilder.blogspot.com/p/5plus.html
    It will tell you (roughly) what part of the formula is invalid. (Although this might need a bit of work on my part.)
    - If you are using a phone/tablet to type in your formula, hold down the quote key to get normal quotes
    - On iOS you can turn off smart punctuation like so: https://www.howtogeek.com/344310/how...hone-and-ipad/

    If you are typing the formula in on PC/Mac:
    - Don't use an app like Word/Pages, that's designed to make documents that look nice for people .Use a "plain text editor" like Notepad/TextEdit, that's okay for code.


    Gosh... I guess it was the copy-paste that got in the way and I didn't even look at the quotes... Thanks!
  • hi friends!

    there is way to calculated accelerations with Appbuilder 5 ?


  • BortoloS if you assume movement in only one direction (that's a big assumption), you could try

    speed_raw - prev(speed_raw)

    for acceleration in metres per second squared.

    But then you have to account for the fact that speed based on GPS is not totally accurate, which is why Garmin rounds to the nearest 5 seconds per km/mile. So you could try to use a 3 second average of speed to smooth things out.

    timeavg(speed_raw, 3) - prev(timeavg(speed_raw, 3))

    If you wanted to take into account change in direction, that would be more complex.
  • Thanks much Flow!!
    it's a good idea.
    For have more accurate value i think to use 3 second option.


  • Former Member
    Former Member over 5 years ago
    Following site has a quite complete formula for cycling power:

    https://www.gribble.org/cycling/power_v_speed.html

    AppBuilder doesn't have trigonometric functions, but seems you can simplify the formula by removing them altogether (SIN(ATAN(x)) hardly changes the grade value and COS(ATAN(x)) will always return close to 1) and it will still give very close to similar values (at least quick values I tested in excel at different speeds / grades).

    (1-(2/100))^-1*(9.8067*(UserWeight+10)*(GETV(1)+0.005)+(0.5*0.63*0.509*1.22601*Speed_raw^2))*Speed_raw

    In the example set weight of bike at 10. Also you could tweak the other constants, I just took the default values from the site. GETV(1) is for grade so you can use SETV(1, insert grade formula here) ; Or replace it with full grade formula.

    Note that if you go downhill you will get negative power at some point. Might be a good idea to add logical operators for example if cadence is 0 then power is 0. Also if power is less than 0 then power is 0.

    Didn't get that far yet, but it's a good starting point to experiment with. Also didn't test it, so sorry if doesn't work yet. Will maybe test it tomorrow on trainer if I got time.
  • Former Member
    Former Member over 5 years ago
    PS. If you use one of the grade formulas presented earlier, first thing would be to to remove multiplier *100 from the end so that it will work with this formula.