Page 1 of 1

Time and distance for certain splits

PostPosted: Sun May 06, 2012 9:32 am
by guillaum
I am trying to get a data on time and distance of certain splits - those for which I will put a certain comment like "Select" in the split notes. This would allow me to manipulate the data of certain selected splits only. Do you have any code handy ?
Thanks
Guillaume

Re: Time and distance for certain splits

PostPosted: Sun May 06, 2012 1:23 pm
by camel
Get a look at DataTrack feature in Formulas pool thread. It's not very much documented. Because it's too hard to use for standard user. (it's based on LINQ)

viewtopic.php?f=67&t=9262&start=125

And here is formula for example to get average hr of split with "Select" note:
{DATATRACK}.Where(o => o.LapNote == "Select").Average(o => o.HR)

And much more could be done with this feature. Note that you can set DataTrack feature resolution to make it more precise and slower or opaque.

Nice day
Peter

Re: Time and distance for certain splits

PostPosted: Mon May 07, 2012 8:38 am
by guillaum
Thanks, this is very useful.

I understand from the Formula Pool / Datatrack thread that time in seconds will be given by

{DATATRACK}.Where(o => o.LapNote == "Select").Count()

Waht is the formula to have the distance achieved during these laps ? I guess the datatrack distance category is for the total distance reached since the start of the run ?

Thanks very much !

Guillaume

Re: Time and distance for certain splits

PostPosted: Mon May 07, 2012 10:01 am
by camel
This is how you get start distance of your split:
{DATATRACK}.Where(o => o.LapNote == "Select").Select(o => o.Distance).First()

And End distance of your split:
{DATATRACK}.Where(o => o.LapNote == "Select").Select(o => o.Distance).Last()

I simply get first point from split and get it's distance and than get last point of split and it's distance.
If you substract end from start, you will get distance of that split:
{DATATRACK}.Where(o => o.LapNote == "Select").Select(o => o.Distance).Last() - {DATATRACK}.Where(o => o.LapNote == "Select").Select(o => o.Distance).First()

Nice day
Peter