This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
entity.reload( )

entity.reload( ) 


 

entity.reload () -> Result 
Parameter Type   Description
Result  Object in Status object

The entity.reload( ) method reloads the content of the entity in memory, according to information stored in the table related to the dataclass in the datastore. The reload is done only if the entity still exists with the same primary key.

Result

The object returned by entity.reload( ) contains the following properties:

PropertyTypeDescription
successbooleanTrue if the reload action is successful, False otherwise.
Available only in case of error:
status(*)numberError code, see below
statusText(*)textDescription of the error, see below

(*) The following values can be returned in the status and statusText properties of Result object in case of error:

Constant Value Comment
dk status entity does not exist anymore 5 The entity no longer exists in the data. This error can occur in the following cases:
  • the entity has been dropped (the stamp has changed and the memory space is now free)
  • the entity has been dropped and replaced by another one with another primary key (the stamp has changed and a new entity now uses the memory space). When using entity.drop( ), this error can be returned when dk force drop if stamp changed option is used. When using entity.lock( ), this error can be returned when dk reload if stamp changed option is used

Associated statusText: "Entity does not exist anymore"

dk status serious error 4 A serious error is a low-level database error (e.g. duplicated key), a hardware error, etc.
Associated statusText: "Other error"

Example  

 C_OBJECT($employee;$employees;$result)
 
 $employees:=ds.Employee.query("lastName=:1";"Hollis")
 $employee:=$employees[0]
 $employee.firstName:="Mary"
 $result:=$employee.reload()
 Case of
    :($result.success)
       ALERT("Reload has been done")
    :($result.status=dk status entity does not exist anymore)
       ALERT("The entity has been dropped")
 End case



See also 

entitySelection[index]

 
PROPERTIES 

Product: 4D
Theme: ORDA - Entity

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)