Skip to content

Built in Expressions Reference

Johan Hernandez edited this page Nov 23, 2011 · 12 revisions

Glossary

  • Bypass result: Returns the last result in the expression-block.
  • Operand: A value given in the hint path or the input to evaluate a condition

Expressions

@return

Description: Returns the input expression as a result

Hint: Unsupported

Input: Executed once

Result: Any value

@get

Description: Returns the variable path in the hint.

Hint: Required, the path of the variable.

Input: Ignored

Result: Any value

@set

Description: Sets the input as the value for the variable path given in the hint.

Hint: Required, the path of the variable.

Input: Executed once

Result: Bypass

@index

Description: Returns a member specified in the input from the last result or the given path in the hint. The input can be a string as the name of the member or a number as the index to query. I will bypass if the operand is null, undefined or is not a object(object or Array)

Hint: Optional, the path of the variable.

Input: Executed once

Result: The value of the member, bypass if the operand is not valid.

@scopeSet

Description: Sets the input as the value for the variable name given in the hint. The variable is created only for the current block, it does not override variables of outer scope.

Hint: Required, the path of the variable.

Input: Executed once

Result: Bypass

@if

Description: Returns the input if the operand is evaluated as true(following the Javascript evaluation rules for booleans), otherwise it returns the result in the block. The operand can be a path in the hint or the previous result.

Hint: Optional, the path of the variable.

Input: Executed once

Result: If the condition is met returns the input, otherwise it Bypass the result.

@unless

Description: Returns the input if the operand is evaluated as false(following the Javascript evaluation rules for booleans). The operand can be a variable name in the hint or the previous result.

Hint: Optional, the path of the variable.

Input: Executed once

Result: If the condition is met returns the input, otherwise it Bypass the result.

@loop

Description: Process the input forever or until it founds a loop control expression. Returns an array with the results of every input execution.

Hint: Optional, prefix for Input variable names.

Input: Executed multiple times.

Result: Array

Input Variables: CurrentIndex

@each

Description: Process the input per element in the array in the last result. Returns an array with the results of every input execution.

Hint: Optional, prefix for Input variable names.

Input: Executed multiple times.

Input Variables: CurrentItem, CurrentIndex

Result: Array

@break

Description: Immediately stops the execution of the current or any other iteration. Any result in the current iteration will NOT be added to the loop.

Hint: Unsupported

Input: Ignored

Result: Bypass

@continue

Description: Immediately stops the execution of the current iteration. Any result in the current iteration will NOT be added to the loop.

Hint: Unsupported

Input: Ignored

Result: Bypass

@input

Description: When used inside JSON code, it executes the input of the root expression. Specially intended for custom expressions.

Hint: Unsupported

Input: Ignored

Result: Any value.

@try

Description: Returns the input, if there is any error it will be saved internally so @catch or @returnError work properly.

Hint: Unsupported

Input: Executed once.

Result: Any value. Bypass if any errors occurs.

@catch

Description: Returns the input if an error was catch by @try. Clears the error automatically.

Hint: Optional, prefix for Input variable names.

Input: Executed once.

Result: Any value. Bypass if there is no errors.

Input Variables: CurrentError

@returnError

Description: Returns the last error in the expression block. if there is no errors it returns undefined.

Hint: Unsupported

Input: Ignored.

Result: Any value.

@clearError

Description: Clears the last error in the expression block.

Hint: Unsupported

Input: Ignored.

Result: Bypass.

@raiseError

Description: Raises an error using the input.

Hint: Unsupported

Input: Executed once.

Result: Bypass.

@equals

Description: Returns true if all the comparable values are equal, otherwise returns false. A hint with 'strict' can enforce the expression to compare types too, by default this is turned off. If operand doesn't have at least two comparable values it will return undefined.

Hint: Optional, "strict" can enforce type checking.

Input: Executed once.

Result: Boolean value or undefined.

@notEquals

Description: Returns true if all the comparable values are not equal, otherwise returns false. A hint with 'strict' can enforce the expression to compare types too, by default this is turned off. If operand doesn't have at least two comparable values it will return undefined. Ignores any input.

Hint: Optional, "strict" can enforce type checking.

Input: Executed once.

Result: Boolean value or undefined.

@increment

Description: Increments the given variable name in the hint by the input. If the operand or the input are not numbers it will assign NaN.

Hint: Required, Variable name.

Input: Executed once.

Result: Bypass.

@decrement

Description: Decrements the given variable name in the hint by the input. If the operand or the input are not numbers it will assign NaN.

Hint: Required, Variable name.

Input: Executed once.

Result: Bypass.