Browse Source

refactor: update docs and description

pull/7019/head
Pranav C 1 year ago
parent
commit
9a6825a43d
  1. 6
      packages/nc-gui/utils/formulaUtils.ts
  2. 8
      packages/noco-docs/docs/070.fields/040.field-types/060.formula/015.operators.md
  3. 20
      packages/noco-docs/docs/070.fields/040.field-types/060.formula/020.numeric-functions.md
  4. 4
      packages/noco-docs/docs/070.fields/040.field-types/060.formula/030.string-functions.md

6
packages/nc-gui/utils/formulaUtils.ts

@ -461,7 +461,7 @@ const formulas: Record<string, any> = {
},
},
description: 'Returns the first match of a regular expression in a string.',
syntax: 'REGEX_MATCH(string, regex)',
syntax: 'REGEX_EXTRACT(string, regex)',
examples: ['REGEX_EXTRACT({title}, "abc.*")'],
},
REGEX_REPLACE: {
@ -601,7 +601,7 @@ const formulas: Record<string, any> = {
rqd: 0,
},
},
description: '',
description: 'Returns the created time of the current record if it exists',
syntax: 'CREATED_TIME()',
examples: ['CREATED_TIME()'],
},
@ -611,7 +611,7 @@ const formulas: Record<string, any> = {
rqd: 0,
},
},
description: '',
description: 'Returns the last modified time of the current record if it exists',
syntax: ' LAST_MODIFIED_TIME()',
examples: [' LAST_MODIFIED_TIME()'],
},

8
packages/noco-docs/docs/070.fields/040.field-types/060.formula/015.operators.md

@ -2,7 +2,7 @@
title: 'Numeric and Logical Operators'
description: 'This article explains various numeric and logical operators that can be used in formula fields.'
tags: ['Fields', 'Field types', 'Formula']
keywords: ['Fields', 'Field types', 'Formula', 'Create formula field', 'Numeric operators', 'Logical operators']
keywords: ['Fields', 'Field types', 'Formula', 'Create formula field', 'Numeric operators', 'Logical operators', 'String operators']
---
@ -32,6 +32,12 @@ Example: `({field1} + ({field2} * {field3}) / (3 - {field4} ))`
| `==` | `{field1} == {field2}` | Equal to |
| `!=` | `{field1} != {field2}` | Not equal to |
### String operators
| Operator | Sample | Description |
|----------|--------------------------|--------------------------|
| `&` | `{field1} & {field2}` | String concatenation |
## Related Articles
- [Numeric Functions](020.numeric-functions.md)

20
packages/noco-docs/docs/070.fields/040.field-types/060.formula/020.numeric-functions.md

@ -18,12 +18,20 @@ keywords: ['Fields', 'Field types', 'Formula', 'Create formula field', 'Numeric
| **FLOOR** | `FLOOR(value)` | `FLOOR({field})` | Rounded largest integer less than or equal to input parameter |
| **INT** | `INT(value)` | `INT({field})` | Integer value of input parameter |
| **LOG** | `LOG([base], value)` | `LOG(10, {field})` | Logarithm of input parameter to the base (default = e) specified |
| **MAX** | `MAX(value1,[value2,...])` | `MAX({field1}, {Field2}, {Field3})` | Maximum value amongst input parameters |
| **MIN** | `MIN(value1,[value2,...])` | `MIN({Field1}, {Field2}, {Field3})` | Minimum value amongst input parameters |
| **MOD** | `MOD(value1, value2)` | `MOD({Field}, 2)` | Remainder after integer division of input parameters |
| **POWER** | `POWER(base, exponent)` | `POWER({Field}, 3)` | `base` to the `exponent` power, as in `base ^ exponent` |
| **ROUND** | `ROUND(value, precision)` | `ROUND({Field}, 3)` | Round input `value` to decimal place specified by `precision` (Nearest integer if `precision` not provided) |
| **SQRT** | `SQRT(value)` | `SQRT({Field})` | Square root of the input parameter |
| **MAX** | `MAX(value1,[value2,...])` | `MAX({field1}, {field2}, {field3})` | Maximum value amongst input parameters |
| **MIN** | `MIN(value1,[value2,...])` | `MIN({field1}, {field2}, {field3})` | Minimum value amongst input parameters |
| **MOD** | `MOD(value1, value2)` | `MOD({field}, 2)` | Remainder after integer division of input parameters |
| **POWER** | `POWER(base, exponent)` | `POWER({field}, 3)` | `base` to the `exponent` power, as in `base ^ exponent` |
| **ROUND** | `ROUND(value, precision)` | `ROUND({field}, 3)` | Round input `value` to decimal place specified by `precision` (Nearest integer if `precision` not provided) |
| **SQRT** | `SQRT(value)` | `SQRT({field})` | Square root of the input parameter |
| **COUNT** | `COUNT(value1,[value2,...])`| `COUNT({field1},{field2},{field3})` | Count the number of arguments that are numbers |
| **COUNTA** | `COUNTA(value1,[value2,...])`| `COUNTA({field1},{field2},{field3})`| Counts the number of non-empty arguments |
| **COUNTALL** | `COUNTALL(value1,[value2,...])`|`COUNTALL({field1},{field2},{field3})`| Counts the number of arguments |
| **EVEN** | `EVEN(value)` | `EVEN({field})` | Returns the nearest even integer that is greater than or equal to the specified value |
| **ODD** | `ODD(value)` | `ODD({field})` | Returns the nearest odd integer that is greater than or equal to the specified value |
| **VALUE** | `VALUE(value)` | `VALUE({field})` | Extract the numeric value from a string, if `%` or `-` is present, it will handle it accordingly and return the numeric value|
| **ROUNDDOWN** | `ROUNDDOWN(value, [precision])` | `ROUNDDOWN({field}, 2)` | Round down the value after the decimal point to the number of decimal places given by "precision"(default is 0) |
| **ROUNDUP** | `ROUNDUP(value, [precision])` | `ROUNDUP({field}, 2)` | Round up the value after the decimal point to the number of decimal places given by "precision"(default is 0) |
## Related Articles

4
packages/noco-docs/docs/070.fields/040.field-types/060.formula/030.string-functions.md

@ -23,6 +23,10 @@ keywords: ['Fields', 'Field types', 'Formula', 'Create formula field', 'String f
| **TRIM** | `TRIM(str)` | `TRIM({field})` | Remove trailing and leading whitespaces from input parameter |
| **UPPER** | `UPPER(str)` | `UPPER({field})` | Upper case converted string of input parameter |
| **URL** | `URL(str)` | `URL({field})` | Convert to a hyperlink if it is a valid URL |
| **REGEX_MATCH** | `REGEX_MATCH(str, pattern)` | `REGEX_MATCH({field}, 'a.*')` | Returns 1 if the input text matches a regular expression or 0 if it does not |
| **REGEX_EXTRACT** | `REGEX_EXTRACT(str, pattern)` | `REGEX_MATCH({field}, 'a.*')` | Returns the first match of a regular expression in a string |
| **REGEX_REPLACE** | `REGEX_REPLACE(str, pattern, replacer)` | `REGEX_MATCH({field}, 'a.*', '---')` | Replaces all matches of a regular expression in a string with a replacement string |
## Related Articles

Loading…
Cancel
Save