getMode Method

Class: Record

Description

This method determines whether the specified record exists. This method can be used in conjunction with the Db.getRecord method, when using its classNew parameter. If the mode is 0 (create mode), the keys entered into the getRecord method are populated into the object. Therefore, no additional coding is required to set those values into the object.

When using the classNew parameter, always use getMode to determine whether an existing record object has been instantiated, or a new object has been instantiated, and program logic should treat the object appropriately based on that.

It is advisable to check the mode when using getRecord to retrieve DEP or LN records. The generated code for a getRecord statement for a RecordDEP checks the class of the object. If the class is L, the code interprets that as a class.new, even though a record with the keys exists as a loan record. if the mode is not checked, a bypassSave of the record will remove the loan record and insert a deposit record.

When there is a chance the record does not exist, you should use the getMode method to determine if you need to add the required field data.

Syntax

recordObject.getMode()

Parameters

None

Returns

1, if the record exists
0, if the record does not exist

When Became Available

Profile v6.4

Example

type Number CID

set CID=98

type RecordDEP dep=Db.getRecord("DEP","CID=:CID",1)

if 'dep.getMode() w !,"new account"

else  w !,"existing account"