pict-section-formeditor 1.0.11 → 1.0.12
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/example_applications/form_editor/package.json +4 -0
- package/example_applications/form_editor_flex/package.json +4 -0
- package/package.json +6 -6
- package/source/views/PictView-FormEditor-PropertiesPanel.js +6 -0
- package/user-documentation/pict_documentation_topics.json +18 -26
- package/user-documentation/solveroperators/add.md +75 -0
- package/user-documentation/solveroperators/assign.md +83 -0
- package/user-documentation/solveroperators/divide.md +73 -0
- package/user-documentation/solveroperators/exponent.md +83 -0
- package/user-documentation/solveroperators/expressionbegin.md +61 -0
- package/user-documentation/solveroperators/modulus.md +70 -0
- package/user-documentation/solveroperators/multiply.md +79 -0
- package/user-documentation/solveroperators/nullcoalesce.md +80 -0
- package/user-documentation/solveroperators/setconcat.md +67 -0
- package/user-documentation/solveroperators/subtract.md +75 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-formeditor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Pict visual editor for pict-section-form configurations",
|
|
5
5
|
"main": "source/Pict-Section-FormEditor.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/stevenvelozo/pict-section-formeditor#readme",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pict-section-code": "^1.0.
|
|
28
|
-
"pict-section-content": "^0.0.
|
|
29
|
-
"pict-section-form": "^1.0.
|
|
30
|
-
"pict-section-markdowneditor": "^1.0.
|
|
27
|
+
"pict-section-code": "^1.0.4",
|
|
28
|
+
"pict-section-content": "^0.0.11",
|
|
29
|
+
"pict-section-form": "^1.0.195",
|
|
30
|
+
"pict-section-markdowneditor": "^1.0.7",
|
|
31
31
|
"pict-section-objecteditor": "^1.0.1",
|
|
32
32
|
"pict-view": "^1.0.67"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"pict": "^1.0.357",
|
|
36
|
-
"quackage": "^1.0.
|
|
36
|
+
"quackage": "^1.0.64"
|
|
37
37
|
},
|
|
38
38
|
"mocha": {
|
|
39
39
|
"diff": true,
|
|
@@ -2134,6 +2134,12 @@ class PictViewFormEditorPropertiesPanel extends libPictView
|
|
|
2134
2134
|
title: tmpDocProvider._CurrentTitle
|
|
2135
2135
|
});
|
|
2136
2136
|
}
|
|
2137
|
+
// Expand the properties panel if it is collapsed so the
|
|
2138
|
+
// user can see the help content.
|
|
2139
|
+
if (tmpSelf._ParentFormEditor._PanelCollapsed)
|
|
2140
|
+
{
|
|
2141
|
+
tmpSelf._ParentFormEditor._UtilitiesProvider.togglePropertiesPanel();
|
|
2142
|
+
}
|
|
2137
2143
|
// Always go through setPanelTab which rebuilds the
|
|
2138
2144
|
// panel DOM fresh (creating #Pict-Content-Body) and
|
|
2139
2145
|
// then calls loadArticle from cache synchronously.
|
|
@@ -636,60 +636,52 @@
|
|
|
636
636
|
},
|
|
637
637
|
"SLV-OP-Add": {
|
|
638
638
|
"TopicCode": "SLV-OP-Add",
|
|
639
|
-
"TopicHelpFilePath": "
|
|
640
|
-
"TopicTitle": "Addition Operator (+)"
|
|
641
|
-
"RelevantMarkdownLine": 39
|
|
639
|
+
"TopicHelpFilePath": "solveroperators/add.md",
|
|
640
|
+
"TopicTitle": "Addition Operator (+)"
|
|
642
641
|
},
|
|
643
642
|
"SLV-OP-Subtract": {
|
|
644
643
|
"TopicCode": "SLV-OP-Subtract",
|
|
645
|
-
"TopicHelpFilePath": "
|
|
646
|
-
"TopicTitle": "Subtraction Operator (-)"
|
|
647
|
-
"RelevantMarkdownLine": 40
|
|
644
|
+
"TopicHelpFilePath": "solveroperators/subtract.md",
|
|
645
|
+
"TopicTitle": "Subtraction Operator (-)"
|
|
648
646
|
},
|
|
649
647
|
"SLV-OP-Multiply": {
|
|
650
648
|
"TopicCode": "SLV-OP-Multiply",
|
|
651
|
-
"TopicHelpFilePath": "
|
|
652
|
-
"TopicTitle": "Multiplication Operator (*)"
|
|
653
|
-
"RelevantMarkdownLine": 36
|
|
649
|
+
"TopicHelpFilePath": "solveroperators/multiply.md",
|
|
650
|
+
"TopicTitle": "Multiplication Operator (*)"
|
|
654
651
|
},
|
|
655
652
|
"SLV-OP-Divide": {
|
|
656
653
|
"TopicCode": "SLV-OP-Divide",
|
|
657
|
-
"TopicHelpFilePath": "
|
|
658
|
-
"TopicTitle": "Division Operator (/)"
|
|
659
|
-
"RelevantMarkdownLine": 37
|
|
654
|
+
"TopicHelpFilePath": "solveroperators/divide.md",
|
|
655
|
+
"TopicTitle": "Division Operator (/)"
|
|
660
656
|
},
|
|
661
657
|
"SLV-OP-Modulus": {
|
|
662
658
|
"TopicCode": "SLV-OP-Modulus",
|
|
663
|
-
"TopicHelpFilePath": "
|
|
664
|
-
"TopicTitle": "Modulus Operator (%)"
|
|
665
|
-
"RelevantMarkdownLine": 38
|
|
659
|
+
"TopicHelpFilePath": "solveroperators/modulus.md",
|
|
660
|
+
"TopicTitle": "Modulus Operator (%)"
|
|
666
661
|
},
|
|
667
662
|
"SLV-OP-Exponent": {
|
|
668
663
|
"TopicCode": "SLV-OP-Exponent",
|
|
669
|
-
"TopicHelpFilePath": "
|
|
670
|
-
"TopicTitle": "Exponentiation Operator (^)"
|
|
671
|
-
"RelevantMarkdownLine": 35
|
|
664
|
+
"TopicHelpFilePath": "solveroperators/exponent.md",
|
|
665
|
+
"TopicTitle": "Exponentiation Operator (^)"
|
|
672
666
|
},
|
|
673
667
|
"SLV-OP-SetConcat": {
|
|
674
668
|
"TopicCode": "SLV-OP-SetConcat",
|
|
675
|
-
"TopicHelpFilePath": "
|
|
669
|
+
"TopicHelpFilePath": "solveroperators/setconcat.md",
|
|
676
670
|
"TopicTitle": "Set Concatenation Operator (,)"
|
|
677
671
|
},
|
|
678
672
|
"SLV-ASSIGN-Equals": {
|
|
679
673
|
"TopicCode": "SLV-ASSIGN-Equals",
|
|
680
|
-
"TopicHelpFilePath": "
|
|
681
|
-
"TopicTitle": "Assignment Operator (=)"
|
|
682
|
-
"RelevantMarkdownLine": 17
|
|
674
|
+
"TopicHelpFilePath": "solveroperators/assign.md",
|
|
675
|
+
"TopicTitle": "Assignment Operator (=)"
|
|
683
676
|
},
|
|
684
677
|
"SLV-ASSIGN-NullCoalesce": {
|
|
685
678
|
"TopicCode": "SLV-ASSIGN-NullCoalesce",
|
|
686
|
-
"TopicHelpFilePath": "
|
|
687
|
-
"TopicTitle": "Null Coalescence Assignment (?=)"
|
|
688
|
-
"RelevantMarkdownLine": 141
|
|
679
|
+
"TopicHelpFilePath": "solveroperators/nullcoalesce.md",
|
|
680
|
+
"TopicTitle": "Null Coalescence Assignment (?=)"
|
|
689
681
|
},
|
|
690
682
|
"SLV-ASSIGN-ExpressionBegin": {
|
|
691
683
|
"TopicCode": "SLV-ASSIGN-ExpressionBegin",
|
|
692
|
-
"TopicHelpFilePath": "
|
|
684
|
+
"TopicHelpFilePath": "solveroperators/expressionbegin.md",
|
|
693
685
|
"TopicTitle": "Expression Begin Directive (:)"
|
|
694
686
|
}
|
|
695
687
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Addition Operator (+)
|
|
2
|
+
|
|
3
|
+
Adds two numeric values together.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
left + right
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `+` operator performs addition on two numeric operands. It uses arbitrary precision arithmetic, so results are accurate even for very large or very small numbers.
|
|
14
|
+
|
|
15
|
+
When used in a solver expression, the `+` operator is one of the standard arithmetic operators and has lower precedence than `*`, `/`, `%`, and `^`.
|
|
16
|
+
|
|
17
|
+
## Precedence
|
|
18
|
+
|
|
19
|
+
The `+` operator has the same precedence as `-` (subtraction). Both are evaluated after `*`, `/`, `%`, and `^`. Use parentheses to override the default order.
|
|
20
|
+
|
|
21
|
+
| Precedence | Operators |
|
|
22
|
+
|------------|-----------|
|
|
23
|
+
| Highest | `^` |
|
|
24
|
+
| | `*` `/` `%` |
|
|
25
|
+
| Lowest | `+` `-` |
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### Basic Addition
|
|
30
|
+
|
|
31
|
+
```expression
|
|
32
|
+
Total = Price + Tax
|
|
33
|
+
// With Price = 100, Tax = 8.50
|
|
34
|
+
// Result: "108.50"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Chaining Multiple Additions
|
|
38
|
+
|
|
39
|
+
```expression
|
|
40
|
+
GrandTotal = Subtotal + Tax + ShippingFee
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Combined with Other Operators
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
// Multiplication is evaluated before addition
|
|
47
|
+
Result = Price + Tax * Quantity
|
|
48
|
+
// Equivalent to: Price + (Tax * Quantity)
|
|
49
|
+
|
|
50
|
+
// Use parentheses to add first
|
|
51
|
+
Result = (Price + Tax) * Quantity
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Adding Constants
|
|
55
|
+
|
|
56
|
+
```expression
|
|
57
|
+
AdjustedScore = RawScore + 10
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Related Operators
|
|
61
|
+
|
|
62
|
+
- [-](./subtract.md) - Subtraction
|
|
63
|
+
- [*](./multiply.md) - Multiplication
|
|
64
|
+
- [/](./divide.md) - Division
|
|
65
|
+
|
|
66
|
+
## Related Functions
|
|
67
|
+
|
|
68
|
+
- [sum](../solverfunctions/sum.md) - Sum all values in an array
|
|
69
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
|
|
73
|
+
- Uses arbitrary precision arithmetic
|
|
74
|
+
- Non-numeric operands may produce unexpected results
|
|
75
|
+
- The result is always returned as a string
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Assignment Operator (=)
|
|
2
|
+
|
|
3
|
+
Assigns the result of the right-hand expression to the left-hand target.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
target = expression
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `=` operator is the assignment operator in solver expressions. It evaluates the expression on the right side and stores the result in the variable or form input identified by the left side.
|
|
14
|
+
|
|
15
|
+
The left-hand target can be:
|
|
16
|
+
- A form input hash (writes the result to that input)
|
|
17
|
+
- A temporary variable name (stores a value for use in later expressions)
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Assigning to a Form Input
|
|
22
|
+
|
|
23
|
+
```expression
|
|
24
|
+
Area = Height * Width
|
|
25
|
+
// Computes Height * Width and writes the result to the input with hash "Area"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Assigning a Constant
|
|
29
|
+
|
|
30
|
+
```expression
|
|
31
|
+
DefaultRate = 0.05
|
|
32
|
+
// Sets DefaultRate to 0.05
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Assigning a Computed Value
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
Tax = round(Subtotal * TaxRate, 2)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Assigning a String
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
Status = if(Total, ">=", 1000, "High Value", "Standard")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Using Temporary Variables
|
|
48
|
+
|
|
49
|
+
```expression
|
|
50
|
+
// Solver ordinal 1: compute intermediates
|
|
51
|
+
TempSubtotal = Price * Quantity
|
|
52
|
+
TempTax = round(TempSubtotal * 0.08, 2)
|
|
53
|
+
|
|
54
|
+
// Solver ordinal 2: compute final values using intermediates
|
|
55
|
+
GrandTotal = TempSubtotal + TempTax
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Expressions Without Assignment
|
|
59
|
+
|
|
60
|
+
Not all expressions need an assignment. Some functions perform side effects directly:
|
|
61
|
+
|
|
62
|
+
```expression
|
|
63
|
+
// These call functions without storing a return value
|
|
64
|
+
SetGroupVisibility("Products", "Details", if(ShowDetails, "==", 1, 1, 0))
|
|
65
|
+
ColorSectionBackground("Summary", "#E0F0E0", 1)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Related Operators
|
|
69
|
+
|
|
70
|
+
- [?=](./nullcoalesce.md) - Null coalescence assignment (assign only if target is empty)
|
|
71
|
+
- [:](./expressionbegin.md) - Expression begin directive
|
|
72
|
+
|
|
73
|
+
## Related Topics
|
|
74
|
+
|
|
75
|
+
- [Solver Expression Walkthrough](../Solver-Expression-Walkthrough.md) - Expression basics
|
|
76
|
+
- [Solvers](../Solvers.md) - How solvers execute
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- The left-hand target is case-sensitive
|
|
81
|
+
- If the target matches a form input hash, the computed value is written to that input
|
|
82
|
+
- If the target does not match any input, it is treated as a temporary variable
|
|
83
|
+
- The `=` operator is evaluated after all arithmetic and function calls on the right side
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Division Operator (/)
|
|
2
|
+
|
|
3
|
+
Divides the left operand by the right operand.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
left / right
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `/` operator performs division on two numeric operands. It uses arbitrary precision arithmetic for accurate results. Division by zero returns `0` rather than causing an error.
|
|
14
|
+
|
|
15
|
+
## Precedence
|
|
16
|
+
|
|
17
|
+
The `/` operator has the same precedence as `*` (multiplication) and `%` (modulus). All three are evaluated before `+` and `-`, but after `^` (exponentiation).
|
|
18
|
+
|
|
19
|
+
| Precedence | Operators |
|
|
20
|
+
|------------|-----------|
|
|
21
|
+
| Highest | `^` |
|
|
22
|
+
| | `*` `/` `%` |
|
|
23
|
+
| Lowest | `+` `-` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Division
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Average = Total / Count
|
|
31
|
+
// With Total = 250, Count = 5
|
|
32
|
+
// Result: "50"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Percentage Calculation
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
PercentComplete = CompletedItems / TotalItems * 100
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### With Rounding
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
// Division can produce many decimal places; round for display
|
|
45
|
+
Rate = round(Amount / Hours, 2)
|
|
46
|
+
// With Amount = 1000, Hours = 3
|
|
47
|
+
// Result: "333.33"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### In a Complex Expression
|
|
51
|
+
|
|
52
|
+
```expression
|
|
53
|
+
// Compute a weighted average
|
|
54
|
+
WeightedAvg = (Score1 * Weight1 + Score2 * Weight2) / (Weight1 + Weight2)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Related Operators
|
|
58
|
+
|
|
59
|
+
- [*](./multiply.md) - Multiplication
|
|
60
|
+
- [%](./modulus.md) - Modulus (remainder)
|
|
61
|
+
- [^](./exponent.md) - Exponentiation
|
|
62
|
+
|
|
63
|
+
## Related Functions
|
|
64
|
+
|
|
65
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
66
|
+
- [avg](../solverfunctions/avg.md) - Compute average of an array
|
|
67
|
+
|
|
68
|
+
## Notes
|
|
69
|
+
|
|
70
|
+
- Uses arbitrary precision arithmetic
|
|
71
|
+
- Division by zero returns `0` (no error is thrown)
|
|
72
|
+
- The result is always returned as a string
|
|
73
|
+
- For long decimal results, use `round` or `tofixed` to limit precision
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Exponentiation Operator (^)
|
|
2
|
+
|
|
3
|
+
Raises the left operand to the power of the right operand.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
base ^ exponent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `^` operator raises a base value to a given power. It uses arbitrary precision arithmetic for accurate results. This is the highest-precedence arithmetic operator.
|
|
14
|
+
|
|
15
|
+
## Precedence
|
|
16
|
+
|
|
17
|
+
The `^` operator has the highest precedence among arithmetic operators. It is evaluated before all others.
|
|
18
|
+
|
|
19
|
+
| Precedence | Operators |
|
|
20
|
+
|------------|-----------|
|
|
21
|
+
| Highest | `^` |
|
|
22
|
+
| | `*` `/` `%` |
|
|
23
|
+
| Lowest | `+` `-` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Exponentiation
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Squared = Value ^ 2
|
|
31
|
+
// With Value = 5
|
|
32
|
+
// Result: "25"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Cubing a Value
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
Cubed = Side ^ 3
|
|
39
|
+
// With Side = 4
|
|
40
|
+
// Result: "64"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Square Root via Fractional Exponent
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
// Square root is the same as raising to the power of 0.5
|
|
47
|
+
SquareRoot = Value ^ 0.5
|
|
48
|
+
// With Value = 16
|
|
49
|
+
// Result: "4"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### In a Complex Expression
|
|
53
|
+
|
|
54
|
+
```expression
|
|
55
|
+
// Exponentiation is evaluated first
|
|
56
|
+
WidthCubeArea = Width ^ 3
|
|
57
|
+
HeightCubeArea = Height ^ 3
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Combined with Other Operators
|
|
61
|
+
|
|
62
|
+
```expression
|
|
63
|
+
// ^ is evaluated before * and +
|
|
64
|
+
Result = 2 + 3 ^ 2 * 4
|
|
65
|
+
// Equivalent to: 2 + (9 * 4) = 2 + 36 = 38
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Related Operators
|
|
69
|
+
|
|
70
|
+
- [*](./multiply.md) - Multiplication
|
|
71
|
+
- [/](./divide.md) - Division
|
|
72
|
+
|
|
73
|
+
## Related Functions
|
|
74
|
+
|
|
75
|
+
- [sqrt](../solverfunctions/sqrt.md) - Square root
|
|
76
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- Uses arbitrary precision arithmetic
|
|
81
|
+
- The result is always returned as a string
|
|
82
|
+
- Fractional exponents compute roots (e.g. `^ 0.5` for square root)
|
|
83
|
+
- Has the highest precedence of all arithmetic operators
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Expression Begin Directive (:)
|
|
2
|
+
|
|
3
|
+
Marks the beginning of an inline expression within a MAP or VAR pipeline.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
MAP VAR name FROM source : expression
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `:` operator signals the start of the expression body in a `MAP ... VAR ... FROM ...` pipeline. Everything after the `:` is the expression that gets evaluated for each element in the source data.
|
|
14
|
+
|
|
15
|
+
The `:` is used exclusively in MAP expressions and is not a general-purpose operator.
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Basic MAP Expression
|
|
20
|
+
|
|
21
|
+
```expression
|
|
22
|
+
// Double each value in a set
|
|
23
|
+
Doubled = MAP VAR x FROM Values : x * 2
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### MAP with Multiple Variables
|
|
27
|
+
|
|
28
|
+
```expression
|
|
29
|
+
// Combine values from two parallel arrays
|
|
30
|
+
Combined = MAP VAR a FROM Prices VAR b FROM Quantities : a * b
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### MAP with Conditional Logic
|
|
34
|
+
|
|
35
|
+
```expression
|
|
36
|
+
// Apply different logic per element
|
|
37
|
+
Adjusted = MAP VAR val FROM RawScores : if(val, ">", 100, 100, val)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### In a Complex Pipeline
|
|
41
|
+
|
|
42
|
+
```expression
|
|
43
|
+
// Map, then aggregate
|
|
44
|
+
ItemTotals = MAP VAR price FROM Prices VAR qty FROM Quantities : price * qty
|
|
45
|
+
GrandTotal = SUM(ItemTotals)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Related Operators
|
|
49
|
+
|
|
50
|
+
- [=](./assign.md) - Assignment operator
|
|
51
|
+
- [,](./setconcat.md) - Set concatenation (argument separator)
|
|
52
|
+
|
|
53
|
+
## Related Topics
|
|
54
|
+
|
|
55
|
+
- [Solver Expressions Advanced Topics](../Solver-Expressions-Advanced.md) - MAP, VAR, FROM details
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
- The `:` must appear after all VAR/FROM declarations in a MAP expression
|
|
60
|
+
- Everything after the `:` is the per-element expression
|
|
61
|
+
- The result of the MAP expression is an array of the computed values
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Modulus Operator (%)
|
|
2
|
+
|
|
3
|
+
Returns the remainder after dividing the left operand by the right operand.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
left % right
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `%` operator computes the modulus (remainder) of dividing the left operand by the right operand. It uses arbitrary precision arithmetic.
|
|
14
|
+
|
|
15
|
+
## Precedence
|
|
16
|
+
|
|
17
|
+
The `%` operator has the same precedence as `*` (multiplication) and `/` (division). All three are evaluated before `+` and `-`, but after `^` (exponentiation).
|
|
18
|
+
|
|
19
|
+
| Precedence | Operators |
|
|
20
|
+
|------------|-----------|
|
|
21
|
+
| Highest | `^` |
|
|
22
|
+
| | `*` `/` `%` |
|
|
23
|
+
| Lowest | `+` `-` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Modulus
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Remainder = 7 % 3
|
|
31
|
+
// Result: "1"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Check for Even/Odd
|
|
35
|
+
|
|
36
|
+
```expression
|
|
37
|
+
// Use if() to test the remainder
|
|
38
|
+
Parity = if(Value % 2, "==", 0, "Even", "Odd")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Cyclic Index
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
// Wrap an index into a fixed range (e.g. 0-11 for months)
|
|
45
|
+
MonthIndex = RawMonth % 12
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Combined with Division
|
|
49
|
+
|
|
50
|
+
```expression
|
|
51
|
+
// Get whole part and remainder separately
|
|
52
|
+
WholePart = floor(Total / GroupSize)
|
|
53
|
+
LeftOver = Total % GroupSize
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Related Operators
|
|
57
|
+
|
|
58
|
+
- [/](./divide.md) - Division
|
|
59
|
+
- [*](./multiply.md) - Multiplication
|
|
60
|
+
|
|
61
|
+
## Related Functions
|
|
62
|
+
|
|
63
|
+
- [floor](../solverfunctions/floor.md) - Round down to integer
|
|
64
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
65
|
+
|
|
66
|
+
## Notes
|
|
67
|
+
|
|
68
|
+
- Uses arbitrary precision arithmetic
|
|
69
|
+
- The result is always returned as a string
|
|
70
|
+
- The sign of the result matches the sign of the left operand
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Multiplication Operator (*)
|
|
2
|
+
|
|
3
|
+
Multiplies two numeric values together.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
left * right
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `*` operator performs multiplication on two numeric operands. It uses arbitrary precision arithmetic for accurate results, even with very large numbers or many decimal places.
|
|
14
|
+
|
|
15
|
+
## Precedence
|
|
16
|
+
|
|
17
|
+
The `*` operator has the same precedence as `/` (division) and `%` (modulus). All three are evaluated before `+` and `-`, but after `^` (exponentiation).
|
|
18
|
+
|
|
19
|
+
| Precedence | Operators |
|
|
20
|
+
|------------|-----------|
|
|
21
|
+
| Highest | `^` |
|
|
22
|
+
| | `*` `/` `%` |
|
|
23
|
+
| Lowest | `+` `-` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Multiplication
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Area = Height * Width
|
|
31
|
+
// With Height = 12, Width = 8
|
|
32
|
+
// Result: "96"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Computing a Product with Multiple Factors
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
Volume = Length * Width * Height
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Combined with Addition
|
|
42
|
+
|
|
43
|
+
```expression
|
|
44
|
+
// Multiplication is evaluated before addition
|
|
45
|
+
Total = BasePrice + TaxRate * BasePrice
|
|
46
|
+
// Equivalent to: BasePrice + (TaxRate * BasePrice)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Using Parentheses
|
|
50
|
+
|
|
51
|
+
```expression
|
|
52
|
+
// Force addition before multiplication
|
|
53
|
+
Result = (Price + Tax) * Quantity
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### With Rounding
|
|
57
|
+
|
|
58
|
+
```expression
|
|
59
|
+
// Multiply and round to 2 decimal places
|
|
60
|
+
Cost = round(UnitPrice * Quantity, 2)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Related Operators
|
|
64
|
+
|
|
65
|
+
- [/](./divide.md) - Division
|
|
66
|
+
- [^](./exponent.md) - Exponentiation
|
|
67
|
+
- [+](./add.md) - Addition
|
|
68
|
+
- [-](./subtract.md) - Subtraction
|
|
69
|
+
|
|
70
|
+
## Related Functions
|
|
71
|
+
|
|
72
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
73
|
+
- [tofixed](../solverfunctions/tofixed.md) - Format to fixed decimal places
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- Uses arbitrary precision arithmetic
|
|
78
|
+
- Non-numeric operands may produce unexpected results
|
|
79
|
+
- The result is always returned as a string
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Null Coalescence Assignment (?=)
|
|
2
|
+
|
|
3
|
+
Assigns a value only if the target is currently empty or undefined.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
target ?= expression
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `?=` operator is a conditional assignment. It evaluates the right-hand expression and assigns the result to the left-hand target only if the target does not already have a value. If the target already contains a non-empty value, the expression is skipped and the existing value is preserved.
|
|
14
|
+
|
|
15
|
+
This is useful for setting default values without overwriting user input or previously computed results.
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Setting a Default Value
|
|
20
|
+
|
|
21
|
+
```expression
|
|
22
|
+
DefaultName ?= "Unnamed"
|
|
23
|
+
// Sets DefaultName to "Unnamed" only if it is currently empty
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Default Numeric Value
|
|
27
|
+
|
|
28
|
+
```expression
|
|
29
|
+
Quantity ?= 1
|
|
30
|
+
// If Quantity has no value yet, set it to 1
|
|
31
|
+
// If the user already entered a quantity, leave it alone
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Default from Another Field
|
|
35
|
+
|
|
36
|
+
```expression
|
|
37
|
+
DisplayName ?= FullName
|
|
38
|
+
// Use FullName as the default for DisplayName, but don't overwrite
|
|
39
|
+
// if DisplayName was already set
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Initializing Computed Defaults
|
|
43
|
+
|
|
44
|
+
```expression
|
|
45
|
+
// Set initial defaults that the user can override
|
|
46
|
+
TaxRate ?= 0.08
|
|
47
|
+
ShippingMethod ?= "Standard"
|
|
48
|
+
Currency ?= "USD"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Combined with Regular Assignment
|
|
52
|
+
|
|
53
|
+
```expression
|
|
54
|
+
// Ordinal 1: Set defaults (only if empty)
|
|
55
|
+
DefaultRate ?= 0.05
|
|
56
|
+
|
|
57
|
+
// Ordinal 2: Compute using the value (whether default or user-entered)
|
|
58
|
+
Tax = round(Subtotal * DefaultRate, 2)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Comparison with = (Regular Assignment)
|
|
62
|
+
|
|
63
|
+
| Operator | Behavior |
|
|
64
|
+
|----------|----------|
|
|
65
|
+
| `=` | Always assigns, overwriting any existing value |
|
|
66
|
+
| `?=` | Only assigns if the target is empty or undefined |
|
|
67
|
+
|
|
68
|
+
## Related Operators
|
|
69
|
+
|
|
70
|
+
- [=](./assign.md) - Regular assignment (always overwrites)
|
|
71
|
+
|
|
72
|
+
## Related Topics
|
|
73
|
+
|
|
74
|
+
- [Solver Expression Walkthrough](../Solver-Expression-Walkthrough.md) - Expression basics
|
|
75
|
+
|
|
76
|
+
## Notes
|
|
77
|
+
|
|
78
|
+
- A value is considered "empty" if it is undefined, null, or an empty string
|
|
79
|
+
- Zero (`0`) is not considered empty — `?=` will not overwrite a zero value
|
|
80
|
+
- Useful for form defaults that should not overwrite user input on re-solve
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Set Concatenation Operator (,)
|
|
2
|
+
|
|
3
|
+
Separates arguments in function calls and constructs sets of values.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
function(arg1, arg2, arg3)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `,` operator is the argument separator in function calls. It separates individual values passed to a function. In the expression tokenizer, commas are classified as the Set Concatenation operator because they join values into an ordered set that the function receives as its argument list.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Function Arguments
|
|
18
|
+
|
|
19
|
+
```expression
|
|
20
|
+
// Pass multiple arguments to round()
|
|
21
|
+
Result = round(Price * Quantity, 2)
|
|
22
|
+
// First argument: Price * Quantity
|
|
23
|
+
// Second argument: 2 (decimal places)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Conditional with Multiple Arguments
|
|
27
|
+
|
|
28
|
+
```expression
|
|
29
|
+
Grade = if(Score, ">=", 90, "A", "F")
|
|
30
|
+
// Arguments: Score, ">=", 90, "A", "F"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### String Functions
|
|
34
|
+
|
|
35
|
+
```expression
|
|
36
|
+
Label = concat(FirstName, " ", LastName)
|
|
37
|
+
// Arguments: FirstName, " ", LastName
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Nested Function Calls
|
|
41
|
+
|
|
42
|
+
```expression
|
|
43
|
+
// Commas separate arguments at each function level
|
|
44
|
+
Result = round(sum(Value1, Value2, Value3), 2)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Special Characters in Strings
|
|
48
|
+
|
|
49
|
+
When you need a literal comma inside a string argument, use the HTML entity `,` to avoid it being interpreted as an argument separator:
|
|
50
|
+
|
|
51
|
+
```expression
|
|
52
|
+
Label = concat(LastName, ", ", FirstName)
|
|
53
|
+
// Result: "Smith, John"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use the `resolvehtmlentities` function to convert entities back to characters when needed.
|
|
57
|
+
|
|
58
|
+
## Related
|
|
59
|
+
|
|
60
|
+
- [Solver Expression Walkthrough](../Solver-Expression-Walkthrough.md) - Expression basics
|
|
61
|
+
- [Solver Functions](../Solver-Functions.md) - Complete function reference
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
|
|
65
|
+
- Commas separate function arguments; they are not a general-purpose list operator
|
|
66
|
+
- Use `,` for literal commas inside string arguments
|
|
67
|
+
- Parentheses define the scope of each function's argument list
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Subtraction Operator (-)
|
|
2
|
+
|
|
3
|
+
Subtracts the right operand from the left operand.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
left - right
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Description
|
|
12
|
+
|
|
13
|
+
The `-` operator performs subtraction on two numeric operands. It uses arbitrary precision arithmetic for accurate results.
|
|
14
|
+
|
|
15
|
+
## Precedence
|
|
16
|
+
|
|
17
|
+
The `-` operator has the same precedence as `+` (addition). Both are evaluated after `*`, `/`, `%`, and `^`. Use parentheses to override the default order.
|
|
18
|
+
|
|
19
|
+
| Precedence | Operators |
|
|
20
|
+
|------------|-----------|
|
|
21
|
+
| Highest | `^` |
|
|
22
|
+
| | `*` `/` `%` |
|
|
23
|
+
| Lowest | `+` `-` |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Subtraction
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Profit = Revenue - Cost
|
|
31
|
+
// With Revenue = 500, Cost = 320
|
|
32
|
+
// Result: "180"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Computing a Difference
|
|
36
|
+
|
|
37
|
+
```expression
|
|
38
|
+
Remaining = Budget - Spent
|
|
39
|
+
// With Budget = 10000, Spent = 7500
|
|
40
|
+
// Result: "2500"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Combined with Other Operators
|
|
44
|
+
|
|
45
|
+
```expression
|
|
46
|
+
// Multiplication is evaluated before subtraction
|
|
47
|
+
NetPay = GrossPay - TaxRate * GrossPay
|
|
48
|
+
// Equivalent to: GrossPay - (TaxRate * GrossPay)
|
|
49
|
+
|
|
50
|
+
// Use parentheses to subtract first
|
|
51
|
+
Discount = (OriginalPrice - Reduction) * Quantity
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Subtracting Constants
|
|
55
|
+
|
|
56
|
+
```expression
|
|
57
|
+
AdjustedIndex = RawIndex - 1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Related Operators
|
|
61
|
+
|
|
62
|
+
- [+](./add.md) - Addition
|
|
63
|
+
- [*](./multiply.md) - Multiplication
|
|
64
|
+
- [/](./divide.md) - Division
|
|
65
|
+
|
|
66
|
+
## Related Functions
|
|
67
|
+
|
|
68
|
+
- [abs](../solverfunctions/abs.md) - Absolute value of a result
|
|
69
|
+
- [round](../solverfunctions/round.md) - Round a computed result
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
|
|
73
|
+
- Uses arbitrary precision arithmetic
|
|
74
|
+
- Non-numeric operands may produce unexpected results
|
|
75
|
+
- The result is always returned as a string
|