## Flow |
Top Previous Next |

These functions allow you to conditionally execute other functions, thus they can be used to affect the "flow" of the expression.

Function: | CallScript |

Result-type: | Unknown |

Arguments: | cScriptName |

Description: | Calls a user-defined Script. Any currently defined variables are available within the script, and any changes to those variables are also copied back out. The 'return' value of the CallScript function is the result of the last executed expression in the script. |

Function: | Eval |

Result-type: | Unknown |

Arguments: | eExpression1 [, eExpression2 ...] |

Description: | Evaluates any number of expressions in order, returning the value of the last one evaluated (all other values discarded). They can be any type of expressions. All expressions are parsed ahead of time. |

Function: | EvalQ |

Result-type: | Unknown |

Arguments: | eQuotedExpression1 [, eQuotedExpression2 ...] |

Description: | Evaluates any number of quoted expressions in order, returning the value of the last one evaluated (all other values discarded). They can be any type of expressions, but each one must be in quotes (or a text result of another expression), and thus will not be parsed until evaluated so it may be slower than Eval() but can be used for expressions that must be completely executed before parsing the next one, etc. |

Function: | EvalQRepeatWhile |

Result-type: | Boolean |

Arguments: | eQuotedExpression1 [, nCount] |

Description: | Evaluates a single quoted expression a given number of times until it returns FALSE, returning FALSE if it did return FALSE, or TRUE if the count ran out first. The quoted expression must return a boolean value. If no repeat count is specified, it will be repeated 100 times. |

Function: | EvalQStepWhile |

Result-type: | Boolean |

Arguments: | eQuotedExpression1 [, eQuotedExpression2 ...] |

Description: | Evaluates any number of quoted expressions in order until one returns FALSE, returning FALSE if the last one evaluated is FALSE, or TRUE if all evaluated to TRUE. The quoted expressions must all return boolean, but each one must be in quotes (or a text result of another expression) |

Function: | IIF |

Result-type: | Unknown |

Arguments: | bExpression, eExpressionTrue, eExpressionFalse) |

Description: | Evaluates the first expression, which must be boolean, and returns either the 2nd or 3rd expression which can be any type. Note that both all expressions will be evaluated/executed regardless of the result |

Function: | IIFQ |

Result-type: | Unknown |

Arguments: | bExpression, cQuotedExpTrue, cQuotedExpFalse) |

Description: | Evaluates the first expression, which must be boolean, and returns either the results of evaluating the 2nd or 3rd quoted expression. Note that only the result expression to be returned is executed, not both of them |

Function: | LoopAvg |

Result-type: | Numeric |

Arguments: | nStart, nEnd, cPlaceholder, cQuotedExpression [, cQuotedCondition] |

Description: | For each number from nStart to nEnd, executes the quoted expression (with the number replacing the placeholder) and returns the average value of all results. Optionally a condition can be specified so that the expression is only evaluated if the condition is met for a given number. |

Function: | LoopConCat |

Result-type: | Text |

Arguments: | nStart, nEnd, cPlaceholder, cQuotedExpression [, cQuotedCondition] |

Description: | For each number from nStart to nEnd, executes the quoted expression (with the number replacing the placeholder) and concatenates (appends) the text to the result. Optionally a condition can be specified so that the expression is only evaluated and concatenated if the condition is met for a given number. |

Function: | LoopFindNth |

Result-type: | Unknown |

Arguments: | nStart, nEnd, nOccurrence, cPlaceholder, cQuotedExpression, cQuotedCondition [, cQuotedDefault] |

Description: | Repeats execution of the quoted condition, replacing the placeholder text with the index numbers in the given start-end range, until the condition returns true nOccurrence times. Then it will return the results of the quoted expression evaluated for that index (or a NULL/error return if not found unless there's a default). For example, it could be used to return the value of the 3rd Charge transaction for a reservation |

Function: | LoopFindNthIndex |

Result-type: | Numeric |

Arguments: | nStart, nEnd, nOccurrence, cPlaceholder, cQuotedCondition |

Description: | Repeats execution of the quoted condition, replacing the placeholder text with the index numbers in the given start-end range, until the condition returns true nOccurrence times. Then it will return that index number (or nStart-1 if it passes the end). For example, it could be used to return the index number of the 3rd Charge transaction for a reservation |

Function: | LoopMax |

Result-type: | Numeric |

Arguments: | nStart, nEnd, cPlaceholder, cQuotedExpression [, cQuotedCondition] |

Description: | For each number from nStart to nEnd, executes the quoted expression (with the number replacing the placeholder) and returns the maximum value of all results. Optionally a condition can be specified so that the expression is only evaluated if the condition is met for a given number. |

Function: | LoopMin |

Result-type: | Numeric |

Arguments: | nStart, nEnd, cPlaceholder, cQuotedExpression [, cQuotedCondition] |

Description: | For each number from nStart to nEnd, executes the quoted expression (with the number replacing the placeholder) and returns the minimum value of all results. Optionally a condition can be specified so that the expression is only evaluated if the condition is met for a given number. |

Function: | LoopSum |

Result-type: | Numeric |

Arguments: | nStart, nEnd, cPlaceholder, cQuotedExpression [, cQuotedCondition] |

Description: | For each number from nStart to nEnd, executes the quoted expression (with the number replacing the placeholder) and adds the value to the result (for boolean expressions, adds 1 for TRUE, 0 for FALSE). Optionally a condition can be specified so that the expression is only evaluated and added if the condition is met for a given number. |

Function: | Macro |

Result-type: | Unknown |

Arguments: | cMacro [, cArgument1 ...] |

Description: | Looks up the macro function of the given name, and executes it with the given arguments. Argument must be quoted, and are replaced in the macro's expression text according to their position, where '#1#' is replaced with cArgument1, etc. |

Function: | Switch |

Result-type: | Unknown |

Arguments: | eTest, eCase1 , eResult1 [, eCase2, eResult2 ...] [, '<default>', eQResultDefault] |

Description: | Returns one of the eResult expressions corresponding to which eCase value matches the eTest value. If '<default>' is specified as the last case, then that result will be returned if none of the other cases are matched. The test and case expressions may be text, numeric, dates, boolean, or record values. All cases and results will be executed regardless of which one is eventually returned |

Function: | SwitchQ |

Result-type: | Unknown |

Arguments: | eTest, eCase1 , eQResult1 [, eCase2, eQResult2 ...] [, '<default>', eQResultDefault] |

Description: | Returns the evaluated results of one of the quoted eQResult expressions corresponding to which eCase value matches the eTest value. If '<default>' is specified as the last case, then that result will be returned if none of the other cases are matched. The test and case expressions may be text, numeric, dates, boolean, or record values. All cases will be executed regardless of which one is eventually matched, but only the returned result will be evaluated |

Function: | SwitchQQ |

Result-type: | Unknown |

Arguments: | eTest, eQCase1 , eQResult1 [, eQCase2, eQResult2 ...] [, '<default>', eQResultDefault] |

Description: | Returns the evaluated results of one of the quoted eQResult expressions corresponding to which quoted eQCase evaluated expression matches the eTest value. If '<default>' is specified as the last case, then that result will be returned if none of the other cases are matched. The test and case expressions may be text, numeric, dates, boolean, or record values. Case expressions will only be executed until one is matched, and only the returned result will be evaluated |