Evaluating Selected DB Elements
- Last UpdatedFeb 08, 2023
- 1 minute read
Using the facilities described here you can create an expression and have it evaluated for all elements which satisfy particular selection criteria. The results of the expression are then placed in a named array.
The command syntax is:
VAR !Array EVALUATE (Expression) FOR select COUNTVAR !Counter
Where:
|
!Array |
is the name of the array that will be created to contain the results of (expression) for all the elements selected within select. |
|
(expression) |
is the expression that will be carried out for all the elements that match the select criteria. |
|
select |
is the selection criteria (see above, and the relevant Reference Manual for your product for further information of selection criteria) |
|
COUNTVAR |
is an optional command which allows you to record how often the expression is calculated in Counter , which is increased by one each time the expression is evaluated. |
You can append the results of such an evaluation to an existing array using the APPEND keyword. For example:
VAR !BOXES APPEND EVALUATE ( XLEN*YLEN ) FOR ALL BOXES
will add the values calculated from the expression for all BOXES to the (already existing) array BOXES.
You can also overwrite elements in the array by specifying the first index in the array which you want to be overwritten. The specified index, and the indexes following it, will be overwritten by the results of the evaluation. For example:
VAR !BOXES[99] EVALUATE ( XLEN*YLEN ) FOR ALL BOXES
will place the result of the first evaluation for the selected elements at index 99, overwriting any existing item, and the following results in the subsequent array elements.