diff --git a/README.md b/README.md index 1cf1a4b7..ecb76075 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,18 @@ Operator | Description --- | --- `ASUM(a, b)` | Aggregated sum of O2M field. For example: calculate shopping cart total price with `ASUM(products, MULTIPLY(price, quantity))` where `products` is the O2M field in the shopping cart and `price` & `quantity` are 2 fields of `products`. +### Condition + +Operator | Description +--- | --- +`IF(A, B, C)` | return `B` if `A` is `true`, otherwise `C` + +## Dynamic Variables + +There are 2 dynamic variables available that you can use in the expressions: +- `$NOW`: return the current Date object. Example: `{{ YEAR($NOW) }}` returns the current year. +- `$CURRENT_USER`: return the current user's id. Example: `{{ EQUAL($CURRENT_USER, user) }}` checks if the `user` field is the current user. + # Limitation - Cannot parse literal strings (`{{ 's' }}`). diff --git a/package-lock.json b/package-lock.json index c4c84ade..91b6a0df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "directus-extension-computed-interface", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "directus-extension-computed-interface", - "version": "1.3.0", + "version": "1.4.0", "license": "gpl-3.0", "devDependencies": { "@babel/core": "^7.19.3", diff --git a/package.json b/package.json index 06e76df6..1976f886 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "directus-extension-computed-interface", - "version": "1.3.0", + "version": "1.4.0", "description": "Perform computed value based on other fields", "author": { "email": "duydvu98@gmail.com",