fix: formula approach
All checks were successful
Publish to docs.datacontroller.io / Deploy docs (push) Successful in 1m3s
All checks were successful
Publish to docs.datacontroller.io / Deploy docs (push) Successful in 1m3s
This commit is contained in:
@@ -30,7 +30,6 @@ The following additional features are necessary:
|
|||||||
|
|
||||||
* Frontend Formulae
|
* Frontend Formulae
|
||||||
* Regex Rules
|
* Regex Rules
|
||||||
* Custom Functions
|
|
||||||
|
|
||||||
The above rules will apply only at frontend, and will be configurable in the MPE_VALIDATIONS table. The values will appear as part of the [editors/getdata](https://code.datacontroller.io/getdata_8sas_source.html) service response in the `dqrules` object.
|
The above rules will apply only at frontend, and will be configurable in the MPE_VALIDATIONS table. The values will appear as part of the [editors/getdata](https://code.datacontroller.io/getdata_8sas_source.html) service response in the `dqrules` object.
|
||||||
|
|
||||||
@@ -60,13 +59,33 @@ HyperFormula requires cell references to operate (rather than named variables),
|
|||||||
|
|
||||||
For ease of use, and to avoid the need to hard code a particular column order, the frontend should perform replacement of the variables for each Formula cell. For instance, replacing ` PRICE ` with ` B1 ` and ` VOLUME ` with ` C1 ` in the first row (and with ` B2 ` and ` C2 ` in the second row respectively).
|
For ease of use, and to avoid the need to hard code a particular column order, the frontend should perform replacement of the variables for each Formula cell. For instance, replacing ` PRICE ` with ` B1 ` and ` VOLUME ` with ` C1 ` in the first row (and with ` B2 ` and ` C2 ` in the second row respectively).
|
||||||
|
|
||||||
To avoid clashes with names that match function names (eg, `MATCH()`) each named variable **must have a leading and trailing blank**, and we should be sure to ignore variables inside of single or double quoted strings - eg `" ITEM & " string ITEM "` (would resolve to `"A1 & "string ITEM "`).
|
To avoid clashes with names that match function names (eg, `MATCH()`) each named variable **must have a leading and trailing blank**, and we should be sure to ignore variables inside of single or double quoted strings - eg ` ITEM & " string ITEM "` (would resolve to `A1 & "string ITEM "`).
|
||||||
|
|
||||||
There would be two types applied:
|
There would be two types applied:
|
||||||
|
|
||||||
* `HARDFORMULA` -> Column is readonly
|
* `HARDFORMULA` -> Column is readonly
|
||||||
* `SOFTFORMULA` -> Column can be changed by the user
|
* `SOFTFORMULA` -> Column can be changed by the user
|
||||||
|
|
||||||
|
To enable conditional logic (eg, show the current user id if row is changed), we also need a new column in the EDIT grid, to show the edit status (Modified, Added, Deleted, Unchanged). This should be the first column, and should NOT be submitted to backend. We could display these values as icons, rather than letters.
|
||||||
|
|
||||||
|
These properties can be accessed using the following literals:
|
||||||
|
|
||||||
|
* DC.ROW_STATUS - replaced at runtime with the cell reference, eg A1 or A2. Values would be M, A, D, or U.
|
||||||
|
* DC.USER_NAME - replaced at runtime with the logged-in user id
|
||||||
|
* DC.ORIG_VALUE - replaced at runtime with the original cell value
|
||||||
|
|
||||||
|
An example of a rule value that intends to show the current user id if the row is changed:
|
||||||
|
|
||||||
|
```
|
||||||
|
RULE_VALUE= if( DC.ROW_STATUS != 'U', DC.USER_NAME, DC.ORIG_VALUE )
|
||||||
|
```
|
||||||
|
|
||||||
|
Which would translate to the following formula, after the page is loaded:
|
||||||
|
|
||||||
|
```
|
||||||
|
=if(A1!='U',"sasdemo","sasinstaller")
|
||||||
|
```
|
||||||
|
|
||||||
**Regex Rules**
|
**Regex Rules**
|
||||||
|
|
||||||
There are two types of rule we can apply in the form of regular expressions:
|
There are two types of rule we can apply in the form of regular expressions:
|
||||||
@@ -74,10 +93,6 @@ There are two types of rule we can apply in the form of regular expressions:
|
|||||||
* `HARDREGEX` -> If the value fails the rule, the data cannot be submitted (turns red)
|
* `HARDREGEX` -> If the value fails the rule, the data cannot be submitted (turns red)
|
||||||
* `SOFTREGEX` -> If the value fails the rule we change the cell colour to yellow (as a warning), but can still submit
|
* `SOFTREGEX` -> If the value fails the rule we change the cell colour to yellow (as a warning), but can still submit
|
||||||
|
|
||||||
**Custom Functions**
|
|
||||||
|
|
||||||
There may be a requirement to implement a non-standard function, eg to return the value of the logged in user. For that we can implement a validation rule named `CUSTOMFUNC`. These functions will be built / tested / documented and packaged by the Data Controller team and shipped inside the product.
|
|
||||||
|
|
||||||
|
|
||||||
### Set Approvals to Zero
|
### Set Approvals to Zero
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user