How To Work With Arrays
Some functions in DriveWorks will return a result that represents tabular data, this is more commonly known as an Array.
Examples of functions that return arrays include the following:
- TableSort
- TableFilter
- TableDistinct
- TableMax
- TableMin
- TableTranspose
- TableFromCsv
Format
The format an array takes within a function is as follows:
- Arrays are enclosed within braces { }.
- Items within arrays are enclosed within quotes " ".
- Columns are separated by commas ,.
- Rows are separated by semi-colons ;.
The result of a function that is in the form of an array will look something like this:
{"Item","Width","Position","Cost";"Single Cupboard Full","600","Rear Wall","280";"Single Cupboard with Drawer","600","Left Wall","300"}
Extracting Values From An Array
All the DriveWorks functions that extract values from a table will extract values from an array.
Typically the array will be stored in a variable or constant.
It is this variable or constant that will be used in any rule that is required to extract a value from the array:
- Create a variable that will store the value extracted from the array.
- Launch the rule builder to build a rule on this variable.
- In the rule editor window type the name of the function required to extract the value or values from the array.
Please refer to the section headed Table Functions in the article Functions for a list of functions that work with tabular data.
- After the function name type ( to begin entering the arguments for the function.
- When rules insight prompts for the argument Table or Table Name select or enter the name of the variable or constant that contains the array.
- Enter the remaining arguments for the function and click OK to apply the rule.
When using one of the table function wizards, in the rule builder, you will be prompted to select a table name...
- If you have a table select it. If you don't have a table leave the field blank.
- Once all fields of the wizard are complete click finish to apply the function into the rule editor window.
- Replace the table name with the name of the variable that results the array.
Knowledge Base Article Ref: | KB14050701 |
---|