Purpose
Evaluates a code block for each record matching a scope and/or condition.
Class
Type
Method
Syntax
<oArrayServer>:Eval(
<cbBlock>,
[<uForCondition>],
[<uWhileCondition>],
[<uScope>
) Æ lSuccess
Arguments
<cbBlock> | A code block that is evaluated for each record in the scope. |
Date type: | CodeBlock | Codeblock |
<uForCondition> | A condition that each record must satisfy so that the code block <cbBlock> is evaluated on the record. If a record does not meet the condition, it is ignored and the next record processed. If the condition is specified as string, it is converted automatically into a _Codeblock statement. The conversion is made here by the command: |
&("{|Server| "+uForCondition+"}")
As a default, the value NIL is used.
Data Type: | String | Codeblock | _Codeblock |
<uWhileCondition> | A condition that each record must satisfy, so that the code block <cbBlock> is evaluated on the record. As soon as a record is found, that the condition meets not, terminated the operation. If the condition is specified as string, it is converted automatically into a _Codeblock statement. The conversion is made here by the command: |
&("{|Server| "+uWhileCondition+"}")
As a default, the value NIL is used.
Data Type: | String | Codeblock | _Codeblock |
<uScope> | The range of records to process. The following values are supported: |
Constant |
Description |
DBSCOPEALL |
The scope contains all records. This is the default. If a WHILE condition is specified, DBSCOPEREST is used. |
DBSCOPEREST |
The scope contains the remaining records beginning with the current record. |
<nRecord> |
The scope contains the next <nRecord> records. |
Data Type: | Usual |
Return Value
lSuccess | A logical value indicates whether all records in scope were processed. |
TRUE | All records were processed. |
FALSE | All records could not be processed. |
Data Type: | Logic |
Description
Before the operation, the server sends a NotifyIntentToMove message. After execution of the operation a NotifyFileChange message is sent independently, whether it was successful or not. After the operation, the record pointer is positioned after the last worked record.
In order to be able to access in the code block <cbBlock> or in the conditions <uForCondition> or <uWhileCondition> to fields, accesses or methods of the server, the literal "Server" followed by a colon must be placed in front of these (see sample).
Samples
The following sample converts the contents of the field LASTNAME in upper case letter.
oasServer:EVAL({|Server|Server:FieldPut("LASTNAME", UPPER(Server:FieldGet("LASTNAME")))})
See Also
Page url: http://www.YOURSERVER.com/index.html?barrayserver_eval.htm