The Instruction Function
The Instruction function is a multi-purpose function that allows interaction and manipulation of inputs
. It can be used for performing arithmetic, string and specialised functionality. Instructions always execute exactly once.
Where should it be used?
The instruction function is used when you want to perform an operation of some kind on a input or set of inputs.
The most basic instruction operation simply copies data from one store or object into another. Arithmetic operations allow you to perform arithmetic operations such as add and subtract across a set of inputs. The instruction supports a variety of string processing instructions and can also used for some specialised functions such as shell execution and one-time database queries.
Instructions must have at least one input
. Depending on the operation in use the number of inputs may vary.
Visual Guide to InstructionSee also:
The instruction's operation indicates how input are processed into the outputs. All inputs are operated on left to right (first to last). The following operations are available.
String processing operations:
Pushes the input data into the output parameters without changing the data. This is the default value for the instruction operation as denoted by the *asterisk and the blue text in the visual guide.
Arithmetic operations: (note: the precision of the outputs of these operations can be set using the precision attribute)
Concatenates the data from all the input elements.
Returns a substring of an initial input value.
Returns the index of the first input in the second input.
Returns the string length of the inputs.
Returns a specified number of characters from the left side of the first input string. Subsequent inputs determine the number of characters.
Returns a specified number of characters from the right side of the first input string. Subsequent inputs determine the number of characters.
Converts a string into lower case.
Converts a string into upper case.
Performs an arithmetic add across all the input parameters.
Performs an arithmetic subtract across all the input parameters.
Performs an arithmetic multiply across all the input parameters.
Performs an arithmetic divide across all the input parameters and pushes the result into the output parameters. Divide is performed accumulatively first to last.
Performs an arithmetic divide across all the input parameters returning the quotient. Arithmetic is performed cumulatively first to last.
Performs a specific task separately from the main program. Also known as a subroutine or subprogram in other languages.
Performs an arithmetic modulus (remainder) across all the input parameters. Arithmetic is performed cumulatively first to last.
Returns the maximum value of all input elements.
Returns the minimum value of all input elements.
Executes a server-side script as specified by the inputs.
Silently executes an SQL statement as specified by the inputs. Returns from the SQL are ignored.
All mathematical functions internally occur at the highest precision (16 decimal places). The output is then rounded to the number of decimal places specified. Zero (integer) is the default as denoted by the blue text in the visual guide.
Basic Instruction Examples
This basic example simply outputs the string "hello world":
<input value="hello world" />
This is a more verbose version of the above example showing where the default values are incorporated:
<output space="immediate" />
<input value="hello world" />
Storing date into a store
This examples shows how you would assign a value to a store:
<output space="store" value="myVar"/>
<input value="pigeon" />
the store "myVar" contains "pigeon"
Arithmetic example: Adding numbers together
This example shows the instruction function being used to arithmetically add together a number of inputs:
<input value="2" />
<input value="3" />
<input value="4" />
String processing example: Trimming a string
This example shows how the "right" string processing operation is used to trim a string:
<input value="Hippopotamus" />
<input value="8" />
Further examples can be found within the documentation for each operation.
Last Modified: Thu, 15 Jan 2015