Skip to content

Commit

Permalink
fix(core/reports): IF_THEN_ELSE renamed to IF
Browse files Browse the repository at this point in the history
  • Loading branch information
robzan8 committed Mar 21, 2023
1 parent fe805a1 commit 4dd3ef4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions projects/core/models/src/utils/expression-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ lists all the functions that are available in the language.
Logs val to the console.

`EVALUATE(condition, then, otherwise)`
Renamed to IF_THEN_ELSE.
Renamed to IF.

`IF_THEN_ELSE(condition, then, otherwise)`
`IF(condition, then, otherwise)`
If the condition is true, evaluates and returns then, otherwise otherwise.

## Forms manipulation functions
Expand Down
2 changes: 1 addition & 1 deletion projects/core/models/src/utils/expression-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ export function ROUND(num: number | string, digits?: number): number {
}

/**
* Deprecated. Use IF_THEN_ELSE
* Deprecated. Use IF
*/
export function EVALUATE(condition: string, branch1: any, branch2: any): any {
if (evaluateExpression(condition)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('indicatorToJs', () => {
expect(result).toBe("SUM(forms, 'pippo')");
});

const indicator3 = '[forms[0], 4+(5), IF_THEN_ELSE(foo, pippo, pluto)]';
const indicator3 = '[forms[0], 4+(5), IF(foo, pippo, pluto)]';
it(indicator3, () => {
const result = indicatorToJs(indicator3);
expect(result).toBe("[forms[0], 4 + (5), (foo ? pippo : pluto)]");
Expand Down
2 changes: 1 addition & 1 deletion projects/core/reports/src/xls-report/hindikit-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function parseFunctionCall(name: string, revToks: Token[]): string {
if (args) {
return parseFunctionWithArgs(name, revToks, args);
}
if (name === 'IF_THEN_ELSE') {
if (name === 'IF') {
consume(revToks, TokenType.LParen);
let js = '(' + parseExpression(revToks, TokenType.Comma) + ' ? ';
consume(revToks, TokenType.Comma);
Expand Down

0 comments on commit 4dd3ef4

Please sign in to comment.