@@ -18,7 +18,7 @@ npm i directus-extension-computed-interface
1818
1919# Get Started
20201 . Go to ** Settings** , create a new field with type string or number.
21- 2 . In the ** Interface** panel, choose ** Computed** interface. There are 2 options:
21+ 2 . In the ** Interface** panel, choose ** Computed** interface. There are 5 options:
2222 1 . ** Template** : Similar to M2M interface, determine how the field is calculated. Learn more about syntax in the next section.
2323 2 . ** Field Mode** : Choose how the value is displayed.
2424 - ** null** : Default option. Show an input with the computed value but still allow manual editing.
@@ -30,9 +30,9 @@ npm i directus-extension-computed-interface
3030
3131# Syntax
3232
33- The template consists of 2 elements: plain strings & expressions.
34- - Plain strings are string literal, often used for text interpolation.
35- - Expressions can contains operators, other fields & numbers . They must be enclosed by ` {{ ` and ` }} ` .
33+ The template consists of 2 elements: ** plain strings** & ** expressions** .
34+ - ** Plain** strings are string literal, often used for text interpolation.
35+ - ** Expressions** can contains operators, field names, numbers & strings . They must be enclosed by ` {{ ` and ` }} ` .
3636
3737## Examples
3838Sum 2 numbers:
@@ -60,6 +60,11 @@ Complex calculation:
6060{{ SUM(MULTIPLY(2, x), b) }}
6161```
6262
63+ Literal strings are enclosed by double quotes (` " ` ):
64+ ```
65+ {{ CONCAT(file, ".txt") }}
66+ ```
67+
6368## Available operators
6469
6570### Type conversion
@@ -119,9 +124,9 @@ Operator | Description
119124` LOWER(a) ` | to lower case
120125` UPPER(a) ` | to upper case
121126` TRIM(a) ` | removes whitespace at the beginning and end of string.
122- ` CONCAT(a, b) ` | concat 2 strings
123- ` LEFT(a, b) ` | extract ` b ` characters from the beginning of the string.
124- ` RIGHT(a, b) ` | extract ` b ` characters from the end of the string.
127+ ` CONCAT(a, b) ` | concat 2 strings ` a ` and ` b ` .
128+ ` LEFT(a, b) ` | extract ` b ` characters from the beginning of the string ` a ` .
129+ ` RIGHT(a, b) ` | extract ` b ` characters from the end of the string ` a ` .
125130
126131### Boolean
127132
@@ -162,7 +167,3 @@ Operator | Description
162167There are 2 dynamic variables available that you can use in the expressions:
163168- ` $NOW ` : return the current Date object. Example: ` {{ YEAR($NOW) }} ` returns the current year.
164169- ` $CURRENT_USER ` : return the current user's id. Example: ` {{ EQUAL($CURRENT_USER, user) }} ` checks if the ` user ` field is the current user.
165-
166-
167- # Limitation
168- - Cannot parse literal strings (` {{ 's' }} ` ).
0 commit comments