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
  • Yes, there is a way to do this. Last lap ascent is not available to CIQ apps, but it wouldn't help you with what you want to calculate, anyway.

    It's a bit of a hack which depends on the fact that TotalAscent never decreases, but it should work.

    Lap Ascent:
    TotalAscent - LAPMIN(TotalAscent)

    Lap Descent:
    TotalDescent - LAPMIN(TotalDescent)

    Lap Elevation Change:
    TotalAscent - LAPMIN(TotalAscent) - (TotalDescent - LAPMIN(TotalDescent))
  • Thanks a lot, I'll try immediatly :-)
  • I tried, it does not work, I have IQ! displayed.
    I also tried other formulas, like cadence / 2 and I still have IQ! displayed.

    Did I miss something?
    I have a FR920XT and I put AppBuilder.
  • Hmm. This doesn't happen in the simulator. (The only physical device I regularly test on is 935).

    Can you contact me via e-mail using "Contact Developer" on the store page? There's a few things we could do try to track this problem down, if you have a few minutes.

    Thanks!
  • Update 2.6.24: Fix crash on CIQ1 devices. This was another problem that doesn't happen in the simulator.

    Thanks to Fa2 for the help with debugging and ECoetzee for the bug report.
  • Hi everyone!
    Congratulations to the programmer for this excellent work.

    I'd like to make a datafield that shows me a timer in minutes. And I explain what I need:

    I'm a soccer referee. In my first screen I have distance, lap time and current heart rate.
    When first half ends I touch the lap hardware button so as to make new lap (2nd lap) and show me the halftime time.
    When the second half starts I touch the lap button so as to show me the 2nd half timer (3rd lap).
    I'd like to have a datafield that when the second half starts (3rd lap) to show me a timer starting from 45 and counting up. I need this because when I have to write a yellow card or a goal I see timer in minutes starting from zero and I have to make the add 45 + time so as to write in my paper.

    Could be a datafield like "45 + lap 3" ?

    Thanks in advance mates ☺☺☺☺
  • Hey,

    If I understand you correctly, you need a data field that shows nothing until lap 3. When lap 3 starts, you want to show 45 (minutes) plus the lap time. That should be doable:

    Formula: IF (LapCount plus 1 LT 3, null, 45 * 60 plus LapTime)
    Display Format: Time

    Explanation
    LapCount: # of laps completed so far: 0 during lap 1, 1 during lap 2, etc.
    LapTime: Lap time, in seconds
    LT: Less than
    null: Represents a blank value, displayed as "--" or "--:--"
    plus: Garmin Connect Mobile iOS doesn't like the plus sign, so "plus" is an alternate symbol

    Display Format: Time: Display seconds as [hh]:mm:ss

    Hope that's what you're looking for. Note that this will only work if you do not press Lap again during the second half.

    Also, if you want to replace your lap time data field with this one, just make the following modification:

    Formula: IF (LapCount plus 1 LT 3, LapTime, 45 * 60 plus LapTime)

  • Hello,

    at first a compliment for the great app. Very nice idea and help for people who have their own wishes, but do not know how to program apps :-)

    I would like to have a field that indicates the probable arrival time of a run when I prescribe the route length. This would avoid in the marathon preparation anger with the wife ;-). So for example run started at 8:00 am a traning run with 35 KM and I am around 10:00 on KM 20 and run a smooth 6er Pace and ran the last minute on average also in 6er Pace. Then I would like to see the clock 11:30 as an anticipated time of arrival. (Enough time to go to showers and lunch ;-)). Otherwise, I need to be faster or shorten the track.

    Basically, I would know how I could calculate it just lacks the possibility to ask the start time as a variable. To this I would add the already timer time and the estimated remaining time due to the current pace for the last minute(s) and would have my arrival time. Can this be realized with the APP?

    Kind regards, Kuki
  • Thanks!

    Okay, I made a quick update which adds timeOfDay (seconds since midnight). If you format this as time, you will see the current time of day in hours, minutes and seconds.

    Limitations:
    - Currently only 24 hour time is available. (If anyone needs AM/PM, I will have to evaluate the impact on adding the code to older devices.)
    - If you start an activity late at night, and do math with timeOfDay, the displayed time can go past 23:59:59. This can be worked around by replacing result with result MOD (24*60*60)

    For your use case:
    - I assume your distance units are in km
    - You want 24 hour time
    - A marathon length is 42.195 km. (Of course you could add a few metres to this to account for GPS discrepencies, not running a perfect race with all the tangents, etc.)
    • ETA for marathon, based on last 60s pace (device distance units in km):
      Display Format: Time
      Formula: timeOfDay plus (42.195 - Distance) * 1000 / TIMEAVG(Speed_raw, 60)
    • Or ETA for X km/miles, based on 60s average speed (distance units = speed units = km or miles)
      Formula: timeOfDay plus (X - Distance) / (TIMEAVG(Speed, 60) / 3600)
    • Finally, here's a formula that works no matter what your speed/distance units are (they can even be different), but you have to specify the target distance in metres:
      Formula: timeOfDay plus (42195 - Distance_raw) / TIMEAVG(Speed_raw, 60)
    Explanation:
    Distance: activity distance in km or miles (based on device settings)
    Distance_raw: distance in metres
    Speed: speed in km or miles per hour [based on device settings]
    Speed_raw: speed in metres per second

    If you want to omit seconds, unfortunately I don't have a display format for that (yet). (Again, I am concerned about memory on older devices.) One workaround would be to use result DIV 60. e.g.

    (timeOfDay plus (42.195 - Distance) * 1000 / TIMEAVG(Speed_raw, 60)) div 60
    Explanation of the math and units, for anyone who wants it:

    Speed = dx / dt = Change in Distance / Change in Time
    Change in Time = Change in Distance / Speed
    Remaining Time = Remaining Distance / Speed

    ETA = Current Time of Day + Remaining Time
    ETA = timeOfDay + Remaining Distance / Speed
    ETA = timeOfDay + (Target Distance - Distance) / Speed


    All the other stuff (multiplying by 1000 or dividing by 3600) is so that the final result is in seconds, and so that the distance/speed units cancel out.
    e.g.timeOfDay plus (42195 - Distance_raw) / TIMEAVG(Speed_raw, 60)

    If we just look at the units in the above formula, (mostly) ignoring the actual variables and constants, we can see that the end result will be in seconds (which works because the Time display format converts seconds to [hh]:mm:ss).
    (Here I'll use ? to signify values that I don't care about, for the purposes of figuring out units)

    ? seconds + (? metres - ? metres) / (? metres / second)
    = ? seconds + ? metres / ? metres / second
    = ? seconds + ? seconds
    = ? seconds

    e.g. timeOfDay plus (42.195 - Distance) * 1000 / TIMEAVG(Speed_raw, 60)
    (Device distance units in km)

    ? seconds + (? km - ? km) * 1000 / ? metres / second
    = ? seconds + ? km * 1000 / ? metres / second
    = ? seconds + ? km * (1000 metres / km) / ? metres / second
    = ? seconds + ? metres / ? metres / second
    = ? seconds + ? seconds
    = ? seconds

    Unfortunately I originally defined Distance, Speed and Altitude so that the units come from your device settings, so that means that the same formula can have different meanings depending on your device units.

    This normally works okay, but as you can see it makes things complicated in some cases. If you need to combine distance or altitude with speed in the same formula, might be better to use raw units, which never change.

    Update 2.6.25:

    Add timeOfDay variable (number of seconds since midnight).