fable 3.1.51 → 3.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -2
- package/dist/fable.js +7 -5
- package/dist/fable.js.map +1 -1
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/docs/.nojekyll +0 -0
- package/docs/README.md +95 -0
- package/docs/_sidebar.md +42 -0
- package/docs/architecture.md +326 -0
- package/docs/cover.md +11 -0
- package/docs/index.html +51 -0
- package/docs/services/README.md +76 -0
- package/docs/services/anticipate.md +331 -0
- package/docs/services/csv-parser.md +152 -0
- package/docs/services/data-format.md +277 -0
- package/docs/services/data-generation.md +142 -0
- package/docs/services/dates.md +216 -0
- package/docs/services/environment-data.md +44 -0
- package/docs/services/expression-parser-functions/README.md +178 -0
- package/docs/services/expression-parser-functions/abs.md +84 -0
- package/docs/services/expression-parser-functions/aggregationhistogram.md +83 -0
- package/docs/services/expression-parser-functions/aggregationhistogrambyobject.md +64 -0
- package/docs/services/expression-parser-functions/arrayconcat.md +64 -0
- package/docs/services/expression-parser-functions/avg.md +81 -0
- package/docs/services/expression-parser-functions/bucketset.md +69 -0
- package/docs/services/expression-parser-functions/ceil.md +70 -0
- package/docs/services/expression-parser-functions/cleanvaluearray.md +66 -0
- package/docs/services/expression-parser-functions/cleanvalueobject.md +68 -0
- package/docs/services/expression-parser-functions/compare.md +72 -0
- package/docs/services/expression-parser-functions/concat.md +73 -0
- package/docs/services/expression-parser-functions/concatraw.md +73 -0
- package/docs/services/expression-parser-functions/cos.md +75 -0
- package/docs/services/expression-parser-functions/count.md +73 -0
- package/docs/services/expression-parser-functions/countset.md +65 -0
- package/docs/services/expression-parser-functions/countsetelements.md +63 -0
- package/docs/services/expression-parser-functions/createarrayfromabsolutevalues.md +63 -0
- package/docs/services/expression-parser-functions/createvalueobjectbyhashes.md +69 -0
- package/docs/services/expression-parser-functions/cumulativesummation.md +96 -0
- package/docs/services/expression-parser-functions/dateadddays.md +79 -0
- package/docs/services/expression-parser-functions/dateaddhours.md +74 -0
- package/docs/services/expression-parser-functions/dateaddmilliseconds.md +65 -0
- package/docs/services/expression-parser-functions/dateaddminutes.md +72 -0
- package/docs/services/expression-parser-functions/dateaddmonths.md +74 -0
- package/docs/services/expression-parser-functions/dateaddseconds.md +66 -0
- package/docs/services/expression-parser-functions/dateaddweeks.md +73 -0
- package/docs/services/expression-parser-functions/dateaddyears.md +74 -0
- package/docs/services/expression-parser-functions/datedaydifference.md +84 -0
- package/docs/services/expression-parser-functions/datefromparts.md +81 -0
- package/docs/services/expression-parser-functions/datehourdifference.md +64 -0
- package/docs/services/expression-parser-functions/datemathadd.md +72 -0
- package/docs/services/expression-parser-functions/datemilliseconddifference.md +64 -0
- package/docs/services/expression-parser-functions/dateminutedifference.md +64 -0
- package/docs/services/expression-parser-functions/datemonthdifference.md +66 -0
- package/docs/services/expression-parser-functions/dateseconddifference.md +64 -0
- package/docs/services/expression-parser-functions/dateweekdifference.md +65 -0
- package/docs/services/expression-parser-functions/dateyeardifference.md +64 -0
- package/docs/services/expression-parser-functions/distributionhistogram.md +96 -0
- package/docs/services/expression-parser-functions/distributionhistogrambyobject.md +64 -0
- package/docs/services/expression-parser-functions/entryinset.md +72 -0
- package/docs/services/expression-parser-functions/euler.md +77 -0
- package/docs/services/expression-parser-functions/exp.md +74 -0
- package/docs/services/expression-parser-functions/findfirstvaluebyexactmatch.md +67 -0
- package/docs/services/expression-parser-functions/findfirstvaluebystringincludes.md +67 -0
- package/docs/services/expression-parser-functions/flatten.md +76 -0
- package/docs/services/expression-parser-functions/floor.md +70 -0
- package/docs/services/expression-parser-functions/gaussianelimination.md +75 -0
- package/docs/services/expression-parser-functions/generatearrayofobjectsfromsets.md +70 -0
- package/docs/services/expression-parser-functions/getvalue.md +90 -0
- package/docs/services/expression-parser-functions/getvaluearray.md +64 -0
- package/docs/services/expression-parser-functions/getvalueobject.md +67 -0
- package/docs/services/expression-parser-functions/if.md +109 -0
- package/docs/services/expression-parser-functions/iterativeseries.md +107 -0
- package/docs/services/expression-parser-functions/join.md +75 -0
- package/docs/services/expression-parser-functions/joinraw.md +64 -0
- package/docs/services/expression-parser-functions/largestinset.md +63 -0
- package/docs/services/expression-parser-functions/leastsquares.md +66 -0
- package/docs/services/expression-parser-functions/linest.md +58 -0
- package/docs/services/expression-parser-functions/log.md +74 -0
- package/docs/services/expression-parser-functions/match.md +71 -0
- package/docs/services/expression-parser-functions/matrixinverse.md +67 -0
- package/docs/services/expression-parser-functions/matrixmultiply.md +71 -0
- package/docs/services/expression-parser-functions/matrixtranspose.md +72 -0
- package/docs/services/expression-parser-functions/matrixvectormultiply.md +69 -0
- package/docs/services/expression-parser-functions/max.md +73 -0
- package/docs/services/expression-parser-functions/mean.md +63 -0
- package/docs/services/expression-parser-functions/median.md +79 -0
- package/docs/services/expression-parser-functions/min.md +73 -0
- package/docs/services/expression-parser-functions/mode.md +66 -0
- package/docs/services/expression-parser-functions/objectkeystoarray.md +66 -0
- package/docs/services/expression-parser-functions/objectvaluessortbyexternalobjectarray.md +65 -0
- package/docs/services/expression-parser-functions/objectvaluestoarray.md +67 -0
- package/docs/services/expression-parser-functions/percent.md +75 -0
- package/docs/services/expression-parser-functions/pi.md +77 -0
- package/docs/services/expression-parser-functions/polynomialregression.md +69 -0
- package/docs/services/expression-parser-functions/predict.md +71 -0
- package/docs/services/expression-parser-functions/rad.md +85 -0
- package/docs/services/expression-parser-functions/randomfloat.md +63 -0
- package/docs/services/expression-parser-functions/randomfloatbetween.md +72 -0
- package/docs/services/expression-parser-functions/randomfloatupto.md +65 -0
- package/docs/services/expression-parser-functions/randominteger.md +56 -0
- package/docs/services/expression-parser-functions/randomintegerbetween.md +72 -0
- package/docs/services/expression-parser-functions/randomintegerupto.md +64 -0
- package/docs/services/expression-parser-functions/resolvehtmlentities.md +64 -0
- package/docs/services/expression-parser-functions/round.md +111 -0
- package/docs/services/expression-parser-functions/setconcatenate.md +64 -0
- package/docs/services/expression-parser-functions/sin.md +83 -0
- package/docs/services/expression-parser-functions/slice.md +80 -0
- package/docs/services/expression-parser-functions/smallestinset.md +63 -0
- package/docs/services/expression-parser-functions/sorthistogram.md +70 -0
- package/docs/services/expression-parser-functions/sorthistogrambykeys.md +69 -0
- package/docs/services/expression-parser-functions/sortset.md +75 -0
- package/docs/services/expression-parser-functions/sqrt.md +85 -0
- package/docs/services/expression-parser-functions/stdev.md +81 -0
- package/docs/services/expression-parser-functions/stdeva.md +58 -0
- package/docs/services/expression-parser-functions/stdevp.md +83 -0
- package/docs/services/expression-parser-functions/stringcountsegments.md +66 -0
- package/docs/services/expression-parser-functions/stringgetsegments.md +74 -0
- package/docs/services/expression-parser-functions/subtractingsummation.md +66 -0
- package/docs/services/expression-parser-functions/sum.md +78 -0
- package/docs/services/expression-parser-functions/tan.md +78 -0
- package/docs/services/expression-parser-functions/tofixed.md +75 -0
- package/docs/services/expression-parser-functions/var.md +67 -0
- package/docs/services/expression-parser-functions/vara.md +58 -0
- package/docs/services/expression-parser-functions/varp.md +66 -0
- package/docs/services/expression-parser-functions/when.md +98 -0
- package/docs/services/expression-parser.md +314 -0
- package/docs/services/file-persistence.md +279 -0
- package/docs/services/logging.md +237 -0
- package/docs/services/logic.md +166 -0
- package/docs/services/manifest.md +256 -0
- package/docs/services/math.md +279 -0
- package/docs/services/meta-template.md +268 -0
- package/docs/services/object-cache.md +171 -0
- package/docs/services/operation.md +207 -0
- package/docs/services/progress-time.md +167 -0
- package/docs/services/progress-tracker-set.md +222 -0
- package/docs/services/rest-client.md +296 -0
- package/docs/services/settings-manager.md +265 -0
- package/docs/services/template.md +233 -0
- package/docs/services/utility.md +304 -0
- package/docs/services/uuid.md +162 -0
- package/package.json +1 -1
- package/source/services/Fable-Service-DataFormat.js +1 -0
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-ValueMarshal.js +6 -4
- package/test/ExpressionParser_tests.js +3 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# floor
|
|
2
|
+
|
|
3
|
+
Returns the largest integer less than or equal to a number.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
floor(value)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `value` | Number/String | The value to floor |
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
String - The largest integer less than or equal to the input.
|
|
20
|
+
|
|
21
|
+
## Description
|
|
22
|
+
|
|
23
|
+
The `floor` function rounds a number down to the nearest integer. For positive numbers, this truncates the decimal portion. For negative numbers, it rounds away from zero (more negative).
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Usage
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Result = floor(3.7)
|
|
31
|
+
// Result: "3"
|
|
32
|
+
|
|
33
|
+
Result = floor(3.2)
|
|
34
|
+
// Result: "3"
|
|
35
|
+
|
|
36
|
+
Result = floor(3.0)
|
|
37
|
+
// Result: "3"
|
|
38
|
+
|
|
39
|
+
Result = floor(-2.3)
|
|
40
|
+
// Result: "-3" (rounds toward negative infinity)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Expressions
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
// Get the integer part of a calculation
|
|
47
|
+
WholeUnits = floor(TotalAmount / UnitPrice)
|
|
48
|
+
|
|
49
|
+
// Determine array index from position
|
|
50
|
+
Index = floor(Position / ItemSize)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Use Cases
|
|
54
|
+
|
|
55
|
+
- **Integer division**: Getting the quotient without remainder
|
|
56
|
+
- **Array indexing**: Converting continuous values to discrete indices
|
|
57
|
+
- **Pagination**: Calculating page numbers
|
|
58
|
+
- **Time calculations**: Converting decimal hours to whole hours
|
|
59
|
+
|
|
60
|
+
## Related Functions
|
|
61
|
+
|
|
62
|
+
- [ceil](./ceil.md) - Round up (ceiling)
|
|
63
|
+
- [round](./round.md) - Round to nearest
|
|
64
|
+
- [tofixed](./tofixed.md) - Format to fixed decimal places
|
|
65
|
+
|
|
66
|
+
## Notes
|
|
67
|
+
|
|
68
|
+
- Uses arbitrary precision arithmetic
|
|
69
|
+
- Returns a string representation
|
|
70
|
+
- For negative numbers, floor(-2.3) = -3, not -2
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# gaussianelimination
|
|
2
|
+
|
|
3
|
+
Solves a system of linear equations using Gaussian elimination.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
gaussianelimination(coefficientMatrix, constantVector)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `coefficientMatrix` | Array | Matrix of coefficients (n×n) |
|
|
16
|
+
| `constantVector` | Array | Vector of constants (length n) |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
Array - Solution vector.
|
|
21
|
+
|
|
22
|
+
## Description
|
|
23
|
+
|
|
24
|
+
The `gaussianelimination` function solves a system of linear equations Ax = b using Gaussian elimination with back substitution.
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```expression
|
|
31
|
+
// Solve:
|
|
32
|
+
// 2x + y = 5
|
|
33
|
+
// x + 3y = 10
|
|
34
|
+
|
|
35
|
+
A = [[2, 1], [1, 3]]
|
|
36
|
+
b = [5, 10]
|
|
37
|
+
Solution = GAUSSIANELIMINATION(A, b)
|
|
38
|
+
// Result: [1, 3] meaning x=1, y=3
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3x3 System
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
// Three equations with three unknowns
|
|
45
|
+
Coefficients = [[1, 2, 1], [2, 6, 1], [1, 1, 4]]
|
|
46
|
+
Constants = [2, 7, 3]
|
|
47
|
+
Solution = GAUSSIANELIMINATION(Coefficients, Constants)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Engineering Problem
|
|
51
|
+
|
|
52
|
+
```expression
|
|
53
|
+
// Solve circuit/structure equations
|
|
54
|
+
Values = GAUSSIANELIMINATION(SystemMatrix, LoadVector)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Use Cases
|
|
58
|
+
|
|
59
|
+
- **Engineering**: Structural analysis
|
|
60
|
+
- **Physics**: Equilibrium problems
|
|
61
|
+
- **Economics**: Input-output models
|
|
62
|
+
- **Optimization**: Constraint systems
|
|
63
|
+
|
|
64
|
+
## Related Functions
|
|
65
|
+
|
|
66
|
+
- [matrixinverse](./matrixinverse.md) - Alternative via inverse
|
|
67
|
+
- [matrixmultiply](./matrixmultiply.md) - Verify solutions
|
|
68
|
+
- [leastsquares](./leastsquares.md) - Overdetermined systems
|
|
69
|
+
|
|
70
|
+
## Notes
|
|
71
|
+
|
|
72
|
+
- Efficient for dense systems
|
|
73
|
+
- Handles n×n systems
|
|
74
|
+
- May have numerical precision limits
|
|
75
|
+
- Uses the Math service's `gaussianElimination` method
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# generatearrayofobjectsfromsets
|
|
2
|
+
|
|
3
|
+
Generates an array of objects from parallel arrays.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
generatearrayofobjectsfromsets(keys, valueArrays)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `keys` | Array | Array of property names |
|
|
16
|
+
| `valueArrays` | Array | Array of value arrays |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
Array - Array of objects with properties from keys and values from arrays.
|
|
21
|
+
|
|
22
|
+
## Description
|
|
23
|
+
|
|
24
|
+
The `generatearrayofobjectsfromsets` function creates an array of objects by combining property names with parallel arrays of values. Each object gets its properties from corresponding positions in the value arrays.
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```expression
|
|
31
|
+
Keys = ["name", "age"]
|
|
32
|
+
Names = ["Alice", "Bob", "Carol"]
|
|
33
|
+
Ages = [25, 30, 35]
|
|
34
|
+
|
|
35
|
+
Result = GENERATEARRAYOFOBJECTSFROMSETS(Keys, [Names, Ages])
|
|
36
|
+
// Result: [
|
|
37
|
+
// { name: "Alice", age: 25 },
|
|
38
|
+
// { name: "Bob", age: 30 },
|
|
39
|
+
// { name: "Carol", age: 35 }
|
|
40
|
+
// ]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From CSV Columns
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
Headers = ["id", "product", "price"]
|
|
47
|
+
Column1 = ["001", "002", "003"]
|
|
48
|
+
Column2 = ["Widget", "Gadget", "Thing"]
|
|
49
|
+
Column3 = [9.99, 19.99, 4.99]
|
|
50
|
+
|
|
51
|
+
Records = GENERATEARRAYOFOBJECTSFROMSETS(Headers, [Column1, Column2, Column3])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Use Cases
|
|
55
|
+
|
|
56
|
+
- **Data transformation**: Convert columnar to row data
|
|
57
|
+
- **CSV processing**: Build objects from columns
|
|
58
|
+
- **Parallel arrays**: Combine related arrays
|
|
59
|
+
- **Data generation**: Create structured data
|
|
60
|
+
|
|
61
|
+
## Related Functions
|
|
62
|
+
|
|
63
|
+
- [createvalueobjectbyhashes](./createvalueobjectbyhashes.md) - Create single object
|
|
64
|
+
- [objectkeystoarray](./objectkeystoarray.md) - Extract keys
|
|
65
|
+
- [flatten](./flatten.md) - Flatten arrays
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- Value arrays should have same length
|
|
70
|
+
- Uses the Math service's `generateArrayOfObjectsFromSets` method
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# getvalue
|
|
2
|
+
|
|
3
|
+
Retrieves a value from application state using a hash/path address.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
getvalue(path)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `path` | String | Dot-notation path to the value (in quotes) |
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
The value at the specified path, or `undefined` if not found.
|
|
20
|
+
|
|
21
|
+
## Description
|
|
22
|
+
|
|
23
|
+
The `getvalue` function retrieves values from the Fable application state (AppData, services, etc.) using a dot-notation path. This allows expressions to access data stored elsewhere in the application.
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Usage
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
// Access a simple value
|
|
31
|
+
PitSize = getvalue("AppData.Pit")
|
|
32
|
+
// If AppData.Pit = "Bottomless"
|
|
33
|
+
// Result: "Bottomless"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Array Access
|
|
37
|
+
|
|
38
|
+
```expression
|
|
39
|
+
// Access array elements
|
|
40
|
+
FirstStudent = GETVALUE("AppData.Students[0]")
|
|
41
|
+
// If AppData.Students = ["Kim", "Jim", "Joan Jett", "Tank Girl"]
|
|
42
|
+
// Result: "Kim"
|
|
43
|
+
|
|
44
|
+
ThirdStudent = GETVALUE("AppData.Students[2]")
|
|
45
|
+
// Result: "Joan Jett"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Nested Object Access
|
|
49
|
+
|
|
50
|
+
```expression
|
|
51
|
+
// Access nested properties
|
|
52
|
+
CityName = getvalue("AppData.Cities[0].city")
|
|
53
|
+
// If AppData.Cities[0] = { city: "New York", state: "New York" }
|
|
54
|
+
// Result: "New York"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### With Null Coalescence Assignment
|
|
58
|
+
|
|
59
|
+
```expression
|
|
60
|
+
// Only assign if target doesn't already have a value
|
|
61
|
+
Name ?= GETVALUE("AppData.Students[0]")
|
|
62
|
+
// Sets Name to "Kim" only if Name is currently empty/undefined
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### In Complex Expressions
|
|
66
|
+
|
|
67
|
+
```expression
|
|
68
|
+
// Combine with other functions
|
|
69
|
+
Histogram = aggregationhistogrambyobject(getvalue("AppData.Teams"), "States", "Score")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Use Cases
|
|
73
|
+
|
|
74
|
+
- **Configuration access**: Reading application settings
|
|
75
|
+
- **Data lookup**: Retrieving stored values
|
|
76
|
+
- **Dynamic references**: Access paths determined at runtime
|
|
77
|
+
- **Cross-module data**: Sharing data between components
|
|
78
|
+
|
|
79
|
+
## Related Functions
|
|
80
|
+
|
|
81
|
+
- [getvaluearray](./getvaluearray.md) - Get array of values
|
|
82
|
+
- [getvalueobject](./getvalueobject.md) - Get object of values
|
|
83
|
+
|
|
84
|
+
## Notes
|
|
85
|
+
|
|
86
|
+
- The path must be quoted (it's a string)
|
|
87
|
+
- Accesses `fable.Utility.getInternalValueByHash`
|
|
88
|
+
- Returns `undefined` if the path doesn't exist
|
|
89
|
+
- Array indices use bracket notation: `[0]`, `[1]`, etc.
|
|
90
|
+
- Works with any data stored on the Fable instance
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# getvaluearray
|
|
2
|
+
|
|
3
|
+
Gets a value from an array by index.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
getvaluearray(array, index)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `array` | Array | The array to retrieve from |
|
|
16
|
+
| `index` | Number | Zero-based index |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
Any - The value at the specified index.
|
|
21
|
+
|
|
22
|
+
## Description
|
|
23
|
+
|
|
24
|
+
The `getvaluearray` function retrieves a value from an array at the specified index. Uses zero-based indexing.
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```expression
|
|
31
|
+
Result = GETVALUEARRAY(["a", "b", "c", "d"], 2)
|
|
32
|
+
// Result: "c" (index 2, third element)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### First Element
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
First = GETVALUEARRAY(Items, 0)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### With Variable Index
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
SelectedItem = GETVALUEARRAY(Options, SelectedIndex)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Use Cases
|
|
48
|
+
|
|
49
|
+
- **Random selection**: Get random array element
|
|
50
|
+
- **Indexed access**: Retrieve by position
|
|
51
|
+
- **Dynamic selection**: Variable-based selection
|
|
52
|
+
- **Data extraction**: Get specific element
|
|
53
|
+
|
|
54
|
+
## Related Functions
|
|
55
|
+
|
|
56
|
+
- [getvalue](./getvalue.md) - Get property from object
|
|
57
|
+
- [getvalueobject](./getvalueobject.md) - Get from object by key
|
|
58
|
+
- [slice](./slice.md) - Get range of elements
|
|
59
|
+
|
|
60
|
+
## Notes
|
|
61
|
+
|
|
62
|
+
- Zero-based indexing
|
|
63
|
+
- Returns undefined for out-of-bounds
|
|
64
|
+
- Uses the Logic service's `getValueArray` method
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# getvalueobject
|
|
2
|
+
|
|
3
|
+
Gets a value from an object by key.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
getvalueobject(object, key)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `object` | Object | The object to retrieve from |
|
|
16
|
+
| `key` | String | The property key |
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
Any - The value of the specified property.
|
|
21
|
+
|
|
22
|
+
## Description
|
|
23
|
+
|
|
24
|
+
The `getvalueobject` function retrieves a value from an object using a string key. This is useful for dynamic property access.
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic Usage
|
|
29
|
+
|
|
30
|
+
```expression
|
|
31
|
+
// Given object: { name: "John", age: 30 }
|
|
32
|
+
Result = GETVALUEOBJECT(Person, "name")
|
|
33
|
+
// Result: "John"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Dynamic Key
|
|
37
|
+
|
|
38
|
+
```expression
|
|
39
|
+
PropertyName = "email"
|
|
40
|
+
Value = GETVALUEOBJECT(User, PropertyName)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Histogram Access
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
// Get count for specific category
|
|
47
|
+
Count = GETVALUEOBJECT(CategoryCounts, "Electronics")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Use Cases
|
|
51
|
+
|
|
52
|
+
- **Dynamic access**: Access property by variable name
|
|
53
|
+
- **Histogram lookup**: Get value by key
|
|
54
|
+
- **Configuration**: Access settings by name
|
|
55
|
+
- **Data extraction**: Get nested values
|
|
56
|
+
|
|
57
|
+
## Related Functions
|
|
58
|
+
|
|
59
|
+
- [getvalue](./getvalue.md) - Get from data state
|
|
60
|
+
- [getvaluearray](./getvaluearray.md) - Get from array by index
|
|
61
|
+
- [objectkeystoarray](./objectkeystoarray.md) - Get all keys
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
|
|
65
|
+
- String key access
|
|
66
|
+
- Returns undefined for missing keys
|
|
67
|
+
- Uses the Logic service's `getValueObject` method
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# if
|
|
2
|
+
|
|
3
|
+
Performs a conditional comparison and returns one of two values based on the result.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
if(left, operator, right, onTrue, onFalse)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `left` | Any | Left value to compare |
|
|
16
|
+
| `operator` | String | Comparison operator |
|
|
17
|
+
| `right` | Any | Right value to compare |
|
|
18
|
+
| `onTrue` | Any | Value returned if comparison is true |
|
|
19
|
+
| `onFalse` | Any | Value returned if comparison is false |
|
|
20
|
+
|
|
21
|
+
### Comparison Operators
|
|
22
|
+
|
|
23
|
+
| Operator | Alias | Description |
|
|
24
|
+
|----------|-------|-------------|
|
|
25
|
+
| `<` | `LT` | Less than |
|
|
26
|
+
| `<=` | `LTE` | Less than or equal |
|
|
27
|
+
| `>` | `GT` | Greater than |
|
|
28
|
+
| `>=` | `GTE` | Greater than or equal |
|
|
29
|
+
| `==` | | Loose equality (with small tolerance for numbers) |
|
|
30
|
+
| `===` | | Strict equality |
|
|
31
|
+
|
|
32
|
+
## Returns
|
|
33
|
+
|
|
34
|
+
The `onTrue` value if the comparison is true, otherwise `onFalse`.
|
|
35
|
+
|
|
36
|
+
## Description
|
|
37
|
+
|
|
38
|
+
The `if` function evaluates a condition and returns different values based on the result. It supports both numeric comparisons (with arbitrary precision) and string comparisons.
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Basic Comparison
|
|
43
|
+
|
|
44
|
+
```expression
|
|
45
|
+
GTE = If(AppData.Cities[0].latitude, "<", "50", "west", "east")
|
|
46
|
+
// If latitude < 50, returns "west", otherwise "east"
|
|
47
|
+
// Result: "west"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### String Comparison
|
|
51
|
+
|
|
52
|
+
```expression
|
|
53
|
+
Equals = If(AppData.Cities[0].city, "==", "New York", "yes", "no")
|
|
54
|
+
// Result: "yes"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Numeric Equality with Tolerance
|
|
58
|
+
|
|
59
|
+
```expression
|
|
60
|
+
// Uses small epsilon for floating point comparison
|
|
61
|
+
EpsilonEquals = If("1.0000000001", "==", "1", "yes", "no")
|
|
62
|
+
// Result: "yes" (within tolerance)
|
|
63
|
+
|
|
64
|
+
// Strict equality requires exact match
|
|
65
|
+
PreciseEquals = If("1.0000000001", "===", "1", "yes", "no")
|
|
66
|
+
// Result: "no" (not exactly equal)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Computed Return Values
|
|
70
|
+
|
|
71
|
+
```expression
|
|
72
|
+
// Return values can be expressions
|
|
73
|
+
Computed = If(AppData.Cities[0].latitude, "<", "50", AppData.Cities[0].latitude + 25, AppData.Cities[0].latitude - 25)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Nested Conditions
|
|
77
|
+
|
|
78
|
+
```expression
|
|
79
|
+
// Chain conditions for multiple outcomes
|
|
80
|
+
Grade = IF(Score, ">=", 90, "A", IF(Score, ">=", 80, "B", IF(Score, ">=", 70, "C", "F")))
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### In Complex Expressions
|
|
84
|
+
|
|
85
|
+
```expression
|
|
86
|
+
// Conditional within larger expressions
|
|
87
|
+
WetCount = IF(DryCount, "<=", 30, DryCount, WetCountIntermediate)
|
|
88
|
+
|
|
89
|
+
// Selecting between computed values
|
|
90
|
+
CombinedValues = MAP VAR dry FROM DryValues VAR wet FROM WetValues VAR x from XValues : IF(x, "LTE", Chart.OptimalMoistureContent, dry, wet)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Use Cases
|
|
94
|
+
|
|
95
|
+
- **Data validation**: Check if values meet criteria
|
|
96
|
+
- **Conditional formatting**: Return different display values
|
|
97
|
+
- **Business logic**: Apply different rules based on conditions
|
|
98
|
+
- **Threshold checks**: Compare against limits
|
|
99
|
+
|
|
100
|
+
## Related Functions
|
|
101
|
+
|
|
102
|
+
- [when](./when.md) - Truthy check (simpler conditional)
|
|
103
|
+
|
|
104
|
+
## Notes
|
|
105
|
+
|
|
106
|
+
- Uses arbitrary precision for numeric comparisons
|
|
107
|
+
- The `==` operator uses a tolerance of 0.000001 for numeric values
|
|
108
|
+
- The `===` operator performs exact comparison for numbers
|
|
109
|
+
- String comparisons are case-sensitive
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# iterativeseries
|
|
2
|
+
|
|
3
|
+
Performs iterative mathematical operations on set elements.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
iterativeseries(array, valueProperty, resultProperty, startValue, operation)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `array` | Array | Array of objects to process |
|
|
16
|
+
| `valueProperty` | String | Property name containing values |
|
|
17
|
+
| `resultProperty` | String | Property name to store results |
|
|
18
|
+
| `startValue` | Number/String | Initial value for the series |
|
|
19
|
+
| `operation` | String | Operation to perform ("add", "subtract", "multiply", "divide") |
|
|
20
|
+
|
|
21
|
+
## Returns
|
|
22
|
+
|
|
23
|
+
Array - The input array with results added to each object.
|
|
24
|
+
|
|
25
|
+
## Description
|
|
26
|
+
|
|
27
|
+
The `iterativeseries` function performs a specified mathematical operation iteratively across an array of objects. It starts with an initial value and applies the operation with each element's value, storing the cumulative result.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
### Cumulative Addition
|
|
32
|
+
|
|
33
|
+
```expression
|
|
34
|
+
Result = ITERATIVESERIES(Values, "Value", "Resultant", 1, "add")
|
|
35
|
+
|
|
36
|
+
// Input:
|
|
37
|
+
Values = [
|
|
38
|
+
{ Value: 10 },
|
|
39
|
+
{ Value: 20 },
|
|
40
|
+
{ Value: 5 }
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
// Output:
|
|
44
|
+
// [
|
|
45
|
+
// { Value: 10, Resultant: "10" }, // 1 - 1 + 10 = 10
|
|
46
|
+
// { Value: 20, Resultant: "30" }, // 10 + 20 = 30
|
|
47
|
+
// { Value: 5, Resultant: "35" } // 30 + 5 = 35
|
|
48
|
+
// ]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Running Product
|
|
52
|
+
|
|
53
|
+
```expression
|
|
54
|
+
Result = ITERATIVESERIES(Data, "Factor", "Product", 1, "multiply")
|
|
55
|
+
|
|
56
|
+
// Input:
|
|
57
|
+
Data = [
|
|
58
|
+
{ Factor: 2 },
|
|
59
|
+
{ Factor: 3 },
|
|
60
|
+
{ Factor: 4 }
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
// Output: Products: 2, 6, 24
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Depreciation Calculation
|
|
67
|
+
|
|
68
|
+
```expression
|
|
69
|
+
// Calculate declining balance
|
|
70
|
+
Assets = [
|
|
71
|
+
{ DepreciationRate: 0.1 },
|
|
72
|
+
{ DepreciationRate: 0.1 },
|
|
73
|
+
{ DepreciationRate: 0.1 }
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
// Start with initial value and multiply by (1 - rate) each period
|
|
77
|
+
Result = ITERATIVESERIES(Assets, "DepreciationRate", "RemainingValue", 1000, "custom")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Available Operations
|
|
81
|
+
|
|
82
|
+
| Operation | Description |
|
|
83
|
+
|-----------|-------------|
|
|
84
|
+
| `"add"` | Cumulative addition |
|
|
85
|
+
| `"subtract"` | Cumulative subtraction |
|
|
86
|
+
| `"multiply"` | Cumulative multiplication |
|
|
87
|
+
| `"divide"` | Cumulative division |
|
|
88
|
+
|
|
89
|
+
## Use Cases
|
|
90
|
+
|
|
91
|
+
- **Financial calculations**: Compound interest, depreciation
|
|
92
|
+
- **Inventory**: Running balance calculations
|
|
93
|
+
- **Statistics**: Cumulative products, geometric series
|
|
94
|
+
- **Process modeling**: Sequential transformations
|
|
95
|
+
|
|
96
|
+
## Related Functions
|
|
97
|
+
|
|
98
|
+
- [cumulativesummation](./cumulativesummation.md) - Specifically for cumulative sums
|
|
99
|
+
- [subtractingsummation](./subtractingsummation.md) - Specifically for subtracting
|
|
100
|
+
- [sum](./sum.md) - Simple sum of all values
|
|
101
|
+
|
|
102
|
+
## Notes
|
|
103
|
+
|
|
104
|
+
- Modifies the input array by adding the result property
|
|
105
|
+
- Uses arbitrary precision arithmetic
|
|
106
|
+
- The start value is used as the initial accumulator
|
|
107
|
+
- Works with the Math service's `iterativeSeries` method
|