Repeating Group Sort by Difference between two fields

I have been wrestling with this for a while and I can’t seem to do what I feel like should be a very simple operation.

General idea is, I am trying to sort a list of races based on split times

Very basically, I have a list of data types where each entry has a series of fields as dates. In my case, it looks like this:

Type: Race
Start = Date
Marker 1 = Date
Marker 2 = Date
Marker 3 = Date
ect…

For easy visuals I want to rank/sort individual split times into a form of leaderboard. For this I have a repeating group that searches for a list of races filtering out for certain parameters (i.e. do both data points exist such that a split time could be calculated). With that list I want to apply a sort based on the difference between two of the fields. So I imagine it would look something like this:

For first marker split:
Search: List of Races
Sort: Marker 1:extract Timecode - Start:extract Timecode

The “Calculate Formula” option doesn’t have an option for generic math operations, and Ranking is looking for a single outside point of comparison.

If I could sort by a value in a cell, this would be totally solved, but that’s not doable.

I could create a new field for each split that I want to make and add it as part of the workflow, but that seems incredibly excessive for this purpose.

What am I missing?

Thanks,
-Ben

Calculate the difference when you record the markers. Maybe even create a new thing to old marker information rather than list all of the marker’s raw time in one thing.

Race

• start (time)
• markers (list of markers)

Marker

• mark (time)
• start (time)
• difference (number)

You could also try the toolbox plugin. It’s got a math section.

That’d be a possible solution if I was only every looking for the split from the marker to the start.

In my situation, I have a defined set of markers and by keeping them as a separate field for each, I am able to create multiple split times from a single point.

i.e. I am also looking for splits from

Marker 1 -> Marker 2
Start -> Marker 3
Marker 3 -> Marker 6
Start -> Finish
ect.

Ideally, it’d be awesome to have two dropdowns so that any user could select a start and end marker so they could create their own split which the repeating group sort would be able to pull from.

I’ll look into the toolbox plugin and see what it has to offer, Thanks for the advice!

Hmmm, yeah, after some experimentation I can’t figure out if there’s a way to sort a list based on a calculated value for each entry. There’s a way to sort based on a field, and a way to dyanimcally select the field, but I don’t see any calculation options.

So what would be nice is something like this:
search for Thing
type: Thing
sort by: calculated field
calculated sort field: field x - field y

@emmanuel

I think @blueback09’s idea of separate Marker thing has merit, allows you a variable number of markers per race.

Perhaps since each marker’s time is only relevant to the race it is in, they won’t be searched on individually, so could keep all the markers in a JSON text.

I think I’m missing a variable … you’d have multiple people in each race too?

One hacky approach to sorting a list this way could be:

search race -> list of races
store in custom state or hidden RG

-> Expression
fn(sort type, list of races’s marker1, list of races’s marker2, …) {
magic function that returns sorted list of item numbers, can be defined in HTML element or in here.
}

-> RG
type: number
source: sorted list item numbers

-> each cell
list of races: item # cell data item number

Edit: simplified by removing a step.

This topic was automatically closed after 70 days. New replies are no longer allowed.