> 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/screenspro/screenspro-native/data-sources.md).

# Data sources

Files, HTTP and ports whose data the layouts bind to as Sources.\<Name>, with an example for each.

Data sources bring live data into the layouts without a client sending it: a file another program writes, a web service, or a device on a serial, TCP or UDP port. Every layout binds to their data as `Sources.<Name>`, as in ScreensPro Server:

```html
<div data-bind="Sources.Results.Value.Title"></div>
<sp-items items="Sources.Results.Value.Row"> ... </sp-items>
<span data-bind="Sources.Timer.Mappings.Time"></span>
```

In XAML layouts: `{Binding Sources.Results.Value.Row}`.

The **Data sources** button in the header lists them with their state and their data - a click on a value copies its binding - and adds and edits them.

<figure><img src="https://2559612140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrJ4OFsK3ODNU79IRd1WF%2Fuploads%2Fgit-blob-3fa3177d15c789710eb79c027a3658380aa32ded%2Fdatasources-list.png?alt=media" alt="Data sources: each with its state and target; a click shows its data - a click on a value copies its binding"><figcaption><p>Data sources: each with its state and target; a click shows its data - a click on a value copies its binding</p></figcaption></figure>

| Kind                   | Reads                                                                          | Good for                                                                                                     |
| ---------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| **File** (XML or JSON) | Read again whenever it changes                                                 | Results, start lists, scores another program writes to disk                                                  |
| **HTTP** (JSON)        | A GET request every few seconds                                                | Web services: live results, standings, weather, social media walls                                           |
| **Port**               | Lines from a serial port, a TCP connection or UDP - as text, or each line JSON | Timing devices, scoreboards, controllers that send text lines; RACE RESULT's exporter, one finisher per line |

Every source has these values:

| Value                                        | Meaning                                                                          |
| -------------------------------------------- | -------------------------------------------------------------------------------- |
| `Value`                                      | The data as objects (file, HTTP; a port whose lines are JSON: the line's object) |
| `Line`, `Mappings.<Name>`                    | The last line and its parts (port)                                               |
| `Queued`                                     | How many lines wait their turn (a port showing one line at a time)               |
| `IsSuccess`                                  | Whether the last read worked                                                     |
| `StatusText`, `ErrorText`                    | State, and the reason of an error                                                |
| `UpdatedAt`                                  | When it last changed                                                             |
| `FileContent` / `ResponseString`, `HttpCode` | The text as it was read, and the HTTP status (for troubleshooting)               |

Unlike ScreensPro Server, a source that fails or can't be parsed (a file read while it is written, cut-off XML, invalid JSON) keeps its last value, with `IsSuccess` false and the reason in `ErrorText` - the layouts don't go empty.

## In this section

* [Files](https://docs.dbnetsoft.com/dbnetsoft/screenspro/screenspro-native/data-sources/files.md) - results from an XML file, a score from a JSON file
* [HTTP](https://docs.dbnetsoft.com/dbnetsoft/screenspro/screenspro-native/data-sources/http.md) - standings from a web service
* [Ports](https://docs.dbnetsoft.com/dbnetsoft/screenspro/screenspro-native/data-sources/ports.md) - a timer on a serial port, the same over TCP or UDP, finishers one at a time over TCP
