A custom column is a component of Copernico that allows you to execute functions on the data. This function is executed only on the computer that is being used. Custom columns allow you to group participant fields, such as first and last name, calculate ages or add up times from different splits.
Custom columns are an advanced feature for which it is necessary to have knowledge of JavaScript to execute the functions. If you are not a developer, don’t worry: we define the custom columns that we consider most relevant and used, and the Column assistant can write the function for you from a description.
1. How to create a custom column?
- On the Participants screen, click the </> icon (Manage custom columns) in the right-hand menu. The Manage custom columns side panel opens.
- Click Create new column (if you have no columns yet, the button is Create my first column).
- The Create new column window opens. Enter the Column name (required; it cannot be changed later) and replace the content of the editor with the function, or ask the assistant for it (see below). Below the editor, the Live preview shows the value the function returns for a sample of the race participants. If the function has errors, the Review the function warning appears. Click Save: the column is enabled for the race you are working on.
On the right of the window is the Column assistant, which knows the fields, splits and helper functions of the race. Describe the column you need (for example, “gap to the category leader”) and click SEND. APPLY CODE moves the code it returns to the editor; COPY CODE copies it. Check the preview before saving.
When you edit a column, the same window opens, with the title Edit.
2. Sample functions
If you know how to program in JavaScript, you only have to enter the functions you want your custom column to execute. But if you don’t, we provide the most used functions: copy them in the text box and paste them in Copernico.
Sum of kilometres
This column will add up all the km travelled by all the participations of each participant. The perfect execution for this function is that the sum is done km by km and for this you must set up timing points every 1 km. The result is shown in metres (for example, 5000 for 5 km). Copy and paste:
function column( athlete, race, event, dataSet, util ) {
const atletasConElMismoChip = dataSet.filter(atleta => atleta.chip[0] == athlete.chip[0]);
const atletasConElMismoChipNoDescalificados = atletasConElMismoChip.filter(atleta => !(['quarantine', 'disqualified'].includes(atleta.status)));
const differentStartTimes = atletasConElMismoChipNoDescalificados.pluck('manualStartTime').unique();
const atletasFiltradosSinStartTimesRepetidos = differentStartTimes.map(manualStartTime => atletasConElMismoChipNoDescalificados.findByProperty('manualStartTime', manualStartTime));
const tiemposDeLosAtletasConElMismoChip = atletasFiltradosSinStartTimesRepetidos.pluck('times').map(timeSet => Object.values(timeSet)).flat().filter(time => time.distance);
const distanciaEntreSplits = 1000;
return tiemposDeLosAtletasConElMismoChip.length * distanciaEntreSplits;
}
Sum of split times
This column will add up the times, so to get the positions you will have to sort this column and use the ordinal column (#) to take it to the presets you are going to use. “T1” will be your first split (split name), “Bike” your second split and “T2” your third split. Copy and paste:
function column( athlete, race, event, dataSet, util ) {
return (athlete.rankings["T1"].time + athlete.rankings["Bike"].time + athlete.rankings["T2"].time).toHHMMSS();
}
Difference to first
This column will calculate the difference in time between the first finisher and the participant. Copy and paste:
function column( athlete, race, event, dataSet, util ) {
return athlete.rankings[util.getFullInterval(event)]
? (athlete.rankings[util.getFullInterval(event)].time - util.getTopRankingTime(util.getFullInterval(event), {event: athlete.event})).toHHMMSS()
: null
}
Difference to first in category
This column will calculate the difference in time between the first finisher in their category and the participant. Copy and paste:
function column( athlete, race, event, dataSet, util ) {
return athlete.rankings[util.getFullInterval(event)]
? (athlete.rankings[util.getFullInterval(event)].time - util.getTopRankingTime(util.getFullInterval(event), {event: athlete.event, category: athlete.category})).toHHMMSS()
: null
}
Difference to first by gender
This column will calculate the time difference to first by gender: time difference between the first male, female or mixed finisher and the participant. Copy and paste:
function column( athlete, race, event, dataSet, util ) {
return athlete.rankings[util.getFullInterval(event)]
? (athlete.rankings[util.getFullInterval(event)].time - util.getTopRankingTime(util.getFullInterval(event), {event: athlete.event, gender: athlete.gender})).toHHMMSS()
: null
}
Code with athlete status
This column will display the code you need for each of the participants' status. Of course, if you need other codes, you can edit it. Please note that finished athletes don’t have a code assigned. Copy and paste:
function column( athlete, race, event, dataSet, util ) {
const statusCodes = {
"finished":"",
"retired":"DNF",
"quarantine":"DNF",
"disqualified":"DQ",
"notstarted":"DNS",
}
return statusCodes[athlete.status]
? statusCodes[athlete.status]
: null
}
3. Custom column management
There are several levels in the custom columns. The Manage custom columns panel groups them as follows:
- Most used custom columns: predefined columns (difference from winner, finish time with milliseconds, athlete's full name and age). Click one to create it; the ones you have already created are no longer listed.
- Columnas activadas para la carrera (columns enabled for the race): the columns enabled in the race you are working on. From here you can disable them or edit your own.
- Mis columnas (my columns): the columns you have created that are not enabled in this race. You can enable, edit or delete them.
- Otras columnas de usuarios de mi empresa (other columns of users of my company): the columns created by other users of your company. You can enable them in your race, but not edit or delete them.
To show the column in the table and position it, see Customizing data tables. To save it in a preset, see Creating presets.
Comments
Please sign in to leave a comment.