Click or drag to resize

DbServer.Replace Method

Replace one or several fields with a new expression, for all records that match a specified scope.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.5
Syntax
 VIRTUAL METHOD Replace(
	acbExpression AS USUAL,
	aFieldList AS USUAL,
	cbForBlock AS USUAL,
	cbWhileBlock AS USUAL,
	uScope AS USUAL
) AS USUAL

Parameters

acbExpression
Type: Usual
The single expression to be evaluated to yield the replacement value or the array of expressions to be evaluated to yield the replacement values.
aFieldList
Type: Usual
The single field to be modified or the array of fields that are to be modified.
cbForBlock
Type: Usual
The condition that is evaluated for each record in the scope; if TRUE, the record is included in the processing.  It provides the same functionality as the FOR clause of record processing commands.
cbWhileBlock
Type: Usual
The condition that is evaluated for each record from the current record until the condition returns FALSE.  It provides the same functionality as the WHILE clause of record processing commands.
uScope
Type: Usual
The range of records to process, providing the same functionality as the ALL, REST and NEXT clauses of record processing commands. Value Description DBSCOPEALL The scope is all the records in the table.  This is the default, although if a WHILE condition is specified, the scope becomes DBSCOPEREST. DBSCOPEREST The scope is the remaining records in the table from the current position. <nRecords> The scope is the next <nRecords> records.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE (although this can still have caused records to be modified).
Remarks
If the specified scope is active, DBServer:Replace() sends a NotifyIntentToMove message before the operation.  It also sends a NotifyFileChange message upon completion, whether successful or not. If no scope is used, on successful completion, the current record will be the last file record and DBServer:EOF will be TRUE.
Examples
The following examples demonstrate how the DBServer:Replace() method can be used:
X#
1// Add 100 to the salaries of female employees
2oDBEmp:Replace({||Salary+100}, #Salary, {||Sex="F"})
3// Subtract 20 from grade, assign a raise of 100,
4// and establish a new raise date for those
5// employees that are newly assigned to Proj20
6oDBEmp:Replace({"GRADE-20", "100", "NewDate"}, {#Grade, #Raise, #RaiseDate},    ;
7{|| NewAssignment(EmpNo) = Proj20})
8// Assign 0 to the credit status field of all records
9oDBEmp:Replace(0,#CreditStatus)
See Also