Skip to content

Commit e12343f

Browse files
committed
Adding some examples to the README
1 parent 1e371ef commit e12343f

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Object respectsPemdas = expression.Evaluator.run('1 + 1 * 10 + 50 * 20 / 100 + (
3232
System.debug(respectsPemdas); // 61
3333
```
3434

35-
### String Operations
35+
## String Operations
3636

3737
```apex
3838
Object simpleConcat = expression.Evaluator.run('"👋 hello " + "there!"');
@@ -43,7 +43,7 @@ Object interpolation = expression.Evaluator.run('"👋 hello ${Name}"', recordId
4343
System.debug(interpolation); // 👋 hello Acme Inc.
4444
```
4545

46-
### Advanced Operations
46+
## Advanced Operations
4747

4848
```apex
4949
// Calculating if a year is a leap year
@@ -68,6 +68,29 @@ Object result = expression.Evaluator.run('IF(ISBLANK(BillingState), "None",\n' +
6868
System.debug(result); // South
6969
```
7070

71+
## Using Lists and Maps
72+
73+
```apex
74+
Object listExample = expression.Evaluator.run('[1, 2, 3]');
75+
System.debug(listExample); // (1 2 3)
76+
77+
Object mapExample = expression.Evaluator.run('{"key": "value"}');
78+
System.debug(mapExample); // {key=value}
79+
```
80+
81+
## Piping Complex Operations
82+
83+
```apex
84+
Id recordId = '001Oy00000GkWjfIAF';
85+
Object result = expression.Evaluator.run(
86+
'ChildAccounts ' +
87+
'-> WHERE(AnnualRevenue > 200) ' +
88+
'-> WHERE(NumberOfEmployees > 10) ' +
89+
'-> MAP(Name)',
90+
recordId);
91+
System.debug(result); // (Acme Inc. Acme Subsidiary)
92+
```
93+
7194
# Documentation
7295

7396
## Table of Contents

0 commit comments

Comments
 (0)