# Variables

Internal funTEST's variables can be used in the "Parameters" column (arguments of a command). All variables are replaced before executing a row. All variables names are case-sensitive.

### Usage&#x20;

The variable name is always between dollar signs: $variable$ Variables can be use anywhere in the text as many times as necessary.

**Example**

<mark style="color:blue;">`#msg | "Hello $user-name$! Your login is $user-login$."`</mark>

Display a simple message with currently logged operator name and login.

### List of Standard Variables

| Name               | Description                                                                                          | Example value                                         |
| ------------------ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| $project-dir$      | Directory of currently used project, without the ending backslash. All backslashes are doubled.      | c:\\\Users\\\Public\\\FPC\\\ funTEST\\\projects\\\ECU |
| $project-name$     | Name of currently used project.                                                                      | ECU                                                   |
| $teststation-dir$  | Directory of currently used test-station, without the ending backslash. All backslashes are doubled. | c:\\\Users\\\Public\\\FPC\\\ funTEST\\\teststations   |
| $teststation-name$ | Name of currently used test-station.                                                                 | MPT6                                                  |
| $testfile-name$    | Name of currently loaded test-file.                                                                  | Var1                                                  |
| $user-login$       | Login name of currently logged-in user.                                                              | admin                                                 |
| $user-name$        | Name of currently logged-in user.                                                                    | Administrator                                         |
| $lang$             | Selected language, short 3-letter variant.                                                           | eng                                                   |
| $YYYY$             | Current year, four-digit.                                                                            | 2015                                                  |
| $YY$               | Current year, 00 to 99, last two-digit.                                                              | 15                                                    |
| $MM$               | Current month, 01 to 12, two-digit.                                                                  | 09                                                    |
| $M$                | Current month, 1 to 12, single or two-digit.                                                         | 9                                                     |
| $DD$               | Current day, 01 to 31, two-digit.                                                                    | 02                                                    |
| $D$                | Current day, 1 to 31, single or two-digit.                                                           | 2                                                     |
| $hh$               | Current hour, 00 to 23, two-digit.                                                                   | 08                                                    |
| $h$                | Current hour, 0 to 23, single or two-digit.                                                          | 8                                                     |
| $mm$               | Current minute, 00 to 59, two-digit.                                                                 | 06                                                    |
| $m$                | Current minute, 0 to 59, single or two-digit.                                                        | 6                                                     |
| $ss$               | Current second, 00 to 59, two-digit.                                                                 | 04                                                    |
| $s$                | Current second, 0 to 59, single or two-digit.                                                        | 4                                                     |
| $panel$            | Active panel number, 0 to N. Set by #panel command.                                                  | 3                                                     |

### User-Defined Variables

Before the row is executed, all test-file variables from the HEAD sheet are collected and added to the list of variables (replacing previous values). \
Test-file variable names are always converted to lower-case.

{% hint style="info" %}
All user-defined variable must be listed in the HEAD sheet
{% endhint %}

<figure><img src="https://3835935664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F10lD1MSN8sl0KAFokfI3%2Fuploads%2FEECMMZ2AMZhsXIm1vdNo%2Fimage.png?alt=media&#x26;token=2c50510b-d304-4314-9ec3-147417fa4883" alt=""><figcaption><p>Variable list in HEAD sheet</p></figcaption></figure>

### #var (Variable operations)

Operations with defines variables in the test-file:&#x20;

**s** - set variable(s) value(s)&#x20;

**st** - set variables(s) value(s), forced text a - append value(s) to specified variable(s)&#x20;

**r** - read values of specified variables&#x20;

**c** - clear values of specified variables&#x20;

Variables shown on the operator's screen are updated automatically when changed on each test-program step.

### Commands Overview

<table data-full-width="true"><thead><tr><th width="149">Command<select><option value="69d37e59dbc44aaca6dc72161f84784b" label="#msg" color="blue"></option><option value="b928d283a7784fae8c94f7bc27467b23" label="#dlg" color="blue"></option><option value="dd3ea796575b44beb6fe421f4c920096" label="#goto" color="blue"></option><option value="2f5a685324fb43dcb163abd13cb8b03b" label="#print" color="blue"></option><option value="e6dc911ebc7543c3be747a3515c56f37" label="#cellerase/#ce" color="blue"></option><option value="e6a5180d2f774bcea3bd75614b8ff78d" label="#cellread/#cr" color="blue"></option><option value="4cf8c7086b134ef4afa85e47badc75bc" label="#cellwrite/#cw" color="blue"></option><option value="14b2706e46b34eef8bbbce5b2d654bdc" label="#var" color="blue"></option></select></th><th width="362">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><span data-option="14b2706e46b34eef8bbbce5b2d654bdc">#var</span></td><td>s:&#x3C;var>=&#x3C;value></td><td>set variable(s) value(s)</td></tr><tr><td><span data-option="14b2706e46b34eef8bbbce5b2d654bdc">#var</span></td><td>a:&#x3C;var>=&#x3C;value></td><td>append value(s) to specified variable(s)</td></tr><tr><td><span data-option="14b2706e46b34eef8bbbce5b2d654bdc">#var</span></td><td>r:&#x3C;var></td><td>read values of specified variables</td></tr><tr><td><span data-option="14b2706e46b34eef8bbbce5b2d654bdc">#var</span></td><td>c:&#x3C;var></td><td>clear values of specified variables</td></tr></tbody></table>

### Examples

{% tabs %}
{% tab title="Example 1 " %}

<table data-full-width="true"><thead><tr><th width="166">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#var</td><td>s:text="abc"</td></tr></tbody></table>

Set value of "text" variable to "abc", return value will be "abc"
{% endtab %}

{% tab title="Example 2" %}

<table data-full-width="true"><thead><tr><th width="166">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#var</td><td>r:text:str</td></tr></tbody></table>

Read variables "text" and "str", return will be for example "abcdef" (according to previous example call)
{% endtab %}
{% endtabs %}

### #cnt (Counter operations)

Set counter value, increment or decrement counter by a value or only read current counter value. Multiple counter operations can be done at once - use a semicolon ";" or doublecolon ":" to separate each counter operation. In this case, the result is the value of first operation.

### Examples

{% tabs %}
{% tab title="Example 1 " %}

<table data-full-width="true"><thead><tr><th width="166">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#cnt</td><td>ok</td></tr></tbody></table>

This will only return value of counter "ok".
{% endtab %}

{% tab title="Example 2" %}

<table data-full-width="true"><thead><tr><th width="166">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#cnt</td><td>ok=0</td></tr></tbody></table>

Set "ok" counter value to 0.
{% endtab %}

{% tab title="Untitled" %}

<table data-full-width="true"><thead><tr><th width="166">Command</th><th>Parameter</th></tr></thead><tbody><tr><td>#cnt</td><td>ok+3</td></tr></tbody></table>

Increment "ok" counter by 3.
{% endtab %}
{% endtabs %}
