roadmap
All checks were successful
Publish to docs.datacontroller.io / Deploy docs (push) Successful in 1m5s
All checks were successful
Publish to docs.datacontroller.io / Deploy docs (push) Successful in 1m5s
This commit is contained in:
@@ -35,29 +35,25 @@ The above rules will apply only at frontend, and will be configurable in the MPE
|
|||||||
|
|
||||||
**Frontend Formulae**
|
**Frontend Formulae**
|
||||||
|
|
||||||
An example of a simple rule would be:
|
The plan here will be to introduce [hyperformula](https://hyperformula.handsontable.com/guide/demo.html) into HandsOnTable. It will allow a library of ~400 functions and advanced excel-like behaviour. It integrates natively [as a plugin with HandsOnTable](https://handsontable.com/docs/javascript-data-grid/formula-calculation/#available-functions).
|
||||||
|
|
||||||
```sas
|
The initial challenge will be that HyperFormula requires cell references to operate, eg:
|
||||||
REVENUE = PRICE * VOLUME
|
|
||||||
```
|
|
||||||
|
|
||||||
How to apply this in Data Controller? Let's consider a table as follows:
|
|
||||||
|
|
||||||
|ITEM|PRICE|VOLUME|REVENUE|
|
|
||||||
|---|---|---|---|
|
|
||||||
|PAPER|4.20|100|`= PRICE * VOLUME`|
|
|
||||||
|PEN|61.02|1,971|`= PRICE * VOLUME`|
|
|
||||||
|
|
||||||
The plan here will be to introduce [hyperformula](https://hyperformula.handsontable.com/guide/demo.html) into HandsOnTable. It will allow a library of ~400 functions and advanced excel-like behaviour.
|
|
||||||
|
|
||||||
HyperFormula requires cell references to operate (rather than named variables), eg as follows:
|
|
||||||
|
|
||||||
|ITEM|PRICE|VOLUME|REVENUE|
|
|ITEM|PRICE|VOLUME|REVENUE|
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
|PAPER|4.20|100|`= B1 * C1`|
|
|PAPER|4.20|100|`= B1 * C1`|
|
||||||
|PEN|61.02|1,971|`= B2 * C2`|
|
|PEN|61.02|1,971|`= B2 * C2`|
|
||||||
|
|
||||||
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).
|
Whereas end users cannot know these references ahead of time. Therefore the references will be made using variable names, eg:
|
||||||
|
|
||||||
|
|
||||||
|
|ITEM|PRICE|VOLUME|REVENUE|
|
||||||
|
|---|---|---|---|
|
||||||
|
|PAPER|4.20|100|`= PRICE * VOLUME`|
|
||||||
|
|PEN|61.02|1,971|`= PRICE * VOLUME`|
|
||||||
|
|
||||||
|
|
||||||
|
The frontend can then 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 "`).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user