> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/alarms/sms-commands.md).

# Query and control DATRAN by text

Text DATRAN to read a value, change a value, or be told when a value changes: the query, set, register and cancel commands.

In addition to sending SMS Messages out of DATRAN, the SMS Service can also be configured to allow DATRAN to be queried or modified from an Operator's mobile phone. For this functionality parts of DATRAN need to be exposed.

{% hint style="info" %}
**Applies to:** the DATRAN VI SMS service through Datashed, and SMS Direct in Full mode from V6.74. QTech's printable SMS card has the same commands. A full description of the SMS query and command format can be found in DATRAN Browser help. Search in the index with "Querying DATRAN".
{% endhint %}

## Expose nodes

This is achieved by adding an `_xmldata_topic_` node under the nodes you wish to expose. No further configuration of the `_xmldata_topic_` is required. The exposed node is then referred to as being the Topic and the subnodes are referred to as Items.

In the following examples the topic name is "Control" and there are 3 items named "reservoirlevel", "pump\runhours" and "pumpreset".

## Commands

| Command        | Example                    | What happens                                                                                                                                                                     |
| -------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Query: `q.`    | `q.control:reservoirlevel` | Issuing a query will result in a single message returned with the topic, item and current value.                                                                                 |
| Set: `s.`      | `s.control:pumpreset=1`    | After issuing a set command, acknowledge the confirmation message with an empty message.                                                                                         |
| Register: `r.` | `r.control:reservoirlevel` | Issuing a register command will result in a single message returned with the topic, item and current value. Now every time this item's value changes a new message will be sent. |
| Cancel: `c.`   | `c.control:reservoirlevel` | Issuing a cancel command will result in the register point being unregistered. Now when the item's value changes no message will be sent.                                        |

The default syntax for querying is `Q.{Topic}:{Item}`. To query a node at a lower level in the tree, such as run hours, the syntax remains the same but the {Item} is `Pump.Run Hours`. Wildcards (`*`) can be used as long as they resolve to one node only.

### With wildcards

| Standard                   | Wildcard      |
| -------------------------- | ------------- |
| `q.control:reservoirlevel` | `q.c*:r*l`    |
| `q.control:pump.runhours`  | `q.c*:p*.*s`  |
| `s.control:pumpreset=1`    | `s.c*:pu*t=1` |

Note: All of the query symbols, for example `Q S R C . : *`, can be changed using the SMS Mobile Info tab of the XML Data Interface configuration dialog. This allows you to customise your system and make it as easy as possible to enter these characters from your handset.

If the path can't be found, DATRAN replies `Path does not exist`.

## Security

For security reasons the operator has to be configured in both the Operator Configuration section and Datashed.
