> For the complete documentation index, see [llms.txt](https://v5docs.keyfax.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v5docs.keyfax.biz/reference/expression-reference/additional-functions/ds.md).

# ds

`ds` is the databox's own value. Use it where a single expression needs that value more than once.

Every function already works on the databox value without being told, so `ds` is only needed when the value has to appear a second time.

| Expression                   | Databox value | Result        |
| ---------------------------- | ------------- | ------------- |
| `Number * Number(ds)`        | `3`           | `9`           |
| `Replace(ds, 'Hello ') + ds` | `world`       | `Hello world` |

The first squares the number: the value multiplied by itself.

**Chaining tests together**

`ds` also makes a chain of tests possible, where each one falls back to the original value so the next can try:

```
='1' Replace('True','Diagnostic Scripts')
     Replace('False', ds ='2' Replace('True','Enquiry Scripts')
     Replace('False', ds ='3' Replace('True','Repairs Online')))
```

Read it outwards. The value is compared with `1`, which gives `True` or `False`. `True` is replaced with the answer you want. `False` is replaced with the whole test again — starting from `ds`, the original value — this time against `2`, and so on until one matches.

This is how a code from a database becomes something a person can read: `RD` becomes a repairs script, `BEN` becomes benefits. It is dense, and a long chain is hard to change later — where the list of codes is long or changes often, a dynamic list or a lookup is easier to live with.
