setMode Method

Class: Record

Description

This method sets the mode of a record to 0 (create) or 1 (update). The method is likely to be used in conjunction with the Record.copy() method, to change the mode of a new record after copying, and before storing it in the database.

Syntax

recordObject.setMode(Number mode)

Parameters

mode

The save mode of the record. Valid values are 0 (create) and 1 (update).

Returns

Void.

When Became Available

Profile v7.0

Example

type RecordACNADDR acnaddr=Db.getRecord("ACNADDR","XCID=:X")

 

type RecordACNADDR acnaddr1 = acnaddr.copy()

 

write !, acnaddr1.getMode()       // mode = 1 (update)

do acnaddr1.setMode(0)            // set to create

write !, acnaddr1.getMode()       // value has changed

set acnaddr1.xcid = $$newXCID(X)  // force new prim. key

do acnaddr1.save()                // insert into db