Collapse AllExpand All

1.2.2. Functions

Functions are independent statements which perform specific operations. If a function returns a value, the value will be outputted. The complete list of available MetaSQL functions is described below:

value

This function operates on the parameter which immediately follows it and returns the value of that parameter. If the parameter is called within a foreach block and the parameter represents a list, the function will return the current item of that list. If the parameter is called outside of a foreach block and the parameter represents a list, the value will default to the first entry. If the parameter named does not exist, then a blank or null value will be returned.

exists

This function operates on the parameter which immediately follows it and returns true if that parameter exists. If the parameter does not exist, then the function returns false. If the parameter is null or blank, the function will still return true because the parameter exists.

reExists

This function takes a regular expression and returns true if one or more parameter exists which match the regular expression. The regular expression is case-sensitive.

isFirst

his function operates on the parameter which immediately follows it. If the parameter is called inside a foreach block and the parameter represents a list, the function will return true if the item returned by the call would be the first item in the list. If the parameter is called outside a foreach block—or if the parameter specified does not represent a list but does exist—then the function will return true. In all other situations, the function will return false.

isLast

This function operates on the parameter which immediately follows it. If the parameter is called inside a foreach block and the parameter represents a list, the function will return true if the item returned by the call would be the last item in the list. If the parameter is called outside a foreach block and the parameter represents a list, the function will return true only if the list contains one item. In all cases, the function will return true if the parameter does not represent a list, but instead represents a single parameter. If the parameter does not exist—or in any other case—this function will return false.

continue

This function will cause the innermost loop to execute to the end and continue as normal. If this statement is used outside of a loop, the function has no effect. If a number is specified, the specified number determines how many loops will be continued. If the number of specified loops is greater than the number of nested loops, then the function will continue the outermost loop.

break

This function will cause the current loop to execute to the end and stop. If the function is used outside of a loop, the function will have no effect. If the number of loops is specified, that determines how many loops will be terminated. If the number of loops to break is greater than the number of nested loops, then all loops will broken.