> For the complete documentation index, see [llms.txt](https://docs.dbnetsoft.com/dbnetsoft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbnetsoft.com/dbnetsoft/raceresultexchange/operation-modes/displayboard/displayboard-brands/fds-mled/scripting/startclock.md).

# Startclock

A "starting clock", like an ALGE ASC3, can be shown with RRExchange.&#x20;

RR12 needs to have an output list containing the next starttime and the bib and name of the athlete to start. RRExchange will periodically pull this list via it's [Globals ](/dbnetsoft/raceresultexchange/scripting/globals.md)feature. Then you can use any of the pre-defined template and use it for displaying these values.&#x20;

## Prepare RR12

Create an output list named `StartClockTest` with the folliwng fields:

| Column Name   | Description                                      |
| ------------- | ------------------------------------------------ |
| CurrentTime   | not needed but good to see if we receive changes |
| NextStarttime | start time of next athlete to start              |
| NextBib       | bib of next athlete top start                    |
| NextName      | name of next athlete to start                    |

Set the Maximum number of records to only 1.

<figure><img src="/files/ldsfEaHkNqjz2zk8Foqr" alt=""><figcaption></figcaption></figure>

## Prepare RRExchange

### Globals

Click on Globals in the top center of the window, then click on RaceResult 12 Lists and add a new entry called StartClockTest and assign the newly created output list.

<figure><img src="/files/vTIQui0HVR548pu5ps0y" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you do not see the newcly created output list, close the Globals window and click on the refresh button next to the event name. This will query all list names again.
{% endhint %}

## Scripting

Bring up the scripting window for the Clear template and remove all existing content. In order to check the retrieveal of the output list, write the following content:

```
{{ StartClockTest.First.CurrentTime }}
```

You should then see a clock, which is generated by the RR12 output list.&#x20;

If so, remove all of it and replace it with this code:

```
{{
     # Check for any scheduled at all (either no row at all or empty starttime)
     if (StartClockTest.First != null && StartClockTest.First.NextStarttime != "")
       # Get current time
       now = Clock
        # Convert time of day to time span
       starttime = ToDateTime StartClockTest.First.NextStarttime
       # Calculate remaining time to start
       timeRemaining = datetime.Subtract starttime now       
       
       # Output string including bib number
       StartClockTest.First.NextBib + " -> " + timespan.FormatRaceResult timeRemaining "mm:ss"       
    else 
         "No one scheduled"
    end
}}
```

<figure><img src="/files/iNd6E13dlIqH2UnUnvaO" alt=""><figcaption></figcaption></figure>

From here on you can add different colors based on the time remaining or clamp the time at 0.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dbnetsoft.com/dbnetsoft/raceresultexchange/operation-modes/displayboard/displayboard-brands/fds-mled/scripting/startclock.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
