FIT WRITE Solution: No Gaps for Invalid Data

Discussed in another thread is the unfortunate issue in which we can't generate a GAP in line graphs for our FIT User Data... for data that is invalid or unavailable. I have a solution that works for me. I have a metric to display Heart Rate Stress. This is relative to nominal HR values for a given sustained and steady power (watt) level. I won't go into the math and research. The point is, the metric can be from about -10 to +20 or so depending on your stress, temp, hydration level, etc. A value of ZERO means your HR matches the model or expected.

But if your power isn't steady or one of several other criteria, I can't generate a meaningful stress value. I wait until conditions are right to generate a data point. Setting it to ZERO is misleading...

So what I now do it oscillate from -0.5 to +0.5 when I'm in an invalid condition state. The graph produces a thicker bar around ZERO which means: "no valid data" during this timeframe. In my case this was a MTB ride and there were times my power level was surging and therefore my HR wasn't steady, and any stress value would be unreliable, so those are times I dropped into the oscilation mode. Also my HR Stress was in the + range because it was hot out today (over 80F) and I wasn't drinking enough. Often my HR Stress starts out in the negative range.

  • I've just wanted to ask about it. So can you confirm that it's impossible to write in fit file NULL value?

    I need some time to count metric so from beginning of activity I don't have anything to save so thought I save null.

    But what does do system's data field if watch can't read e.g. HR during activity? What to do of in compute info.currentHeartRate is null?  

    maybe system simple connects two valid points with line, no gap but line

  • Yes I can confirm. We've tried NULLS and we've tried the official INVALID values as defined by the FIT standard. Nothing works.

  • But what does do system's data field if watch can't read e.g. HR during activity? What to do of in compute info.currentHeartRate is null?  

    maybe system simple connects two valid points with line, no gap but line

    I think I've seen gaps from native data fields in the past, but it was a long time ago. I also never had a chance to look at what the data actually was in the FIT file. (i.e. Was it "no data" / gaps, or was it invalid values, or maybe something else?)

  • I need some time to count metric so from beginning of activity I don't have anything to save so thought I save null.

    If your gap is at the start of the activity, you can simply avoid calling FitContributor.setData() until you have data to write. This is an exception to the problem because of course if you never called setData() even once, the system has no idea what you want to write, so it won't write anything (afaik).

    If I recall correctly, I tried this in the past, and it works, although the specifics of how the "gap" is rendered may vary depending on whether you look at the activity in the Connect app or on the website.

    This thread is more than 4 years old >_<

    https://forums.garmin.com/developer/connect-iq/f/discussion/7509/fitcontributor-field-setdata-should-accept-null-as-a-value/1435857

    Now consider the case of a Connect IQ field recording the exact same data.

    If there's no HR data available at beginning of the run and the field hasn't called setData yet, no problem. The records for the 3rd-party field won't be present for that time period. But the first time the app calls setData, it's obligated to keep doing so every second, even if it has no data. If you don't call setData, the device just records the last value you set. And if you call setData with null, it crashes.

  • So I resign, I don't want to explain users why data in graph are bad especially the answer can be only one (again) bug in ciq/hw, platform limit etc.