Setinstance

This instruction performs an assignment between the properties of a class instance and the content of a file class (for example, an [F:_xxxx] table buffer), in one direction or the other.

This transfer is based on the property names and the column names; however, the transfer is done only on the common names.

This instruction is used intensively by the CRUD operation support implemented in the supervisor layer. The name of the columns in the database tables and the name of the property in a class should be the same if the development partner wants to benefit from a complete automatic management of class persistence in the database. If this is not the case for some properties, the development partner must write the assignment directly in the corresponding events available in CRUD management.

Syntax

SetInstance [F:xxxx] With INSTANCE_NAMESetInstance INSTANCE_NAME With [F:xxxx]
**Note:** [F:xxxx] is the buffer-class description, that can also be written [xxxx] if there is no ambiguity.

Example

# Instance pointer on a customer classLocal Instance MY_CUSTOMER Using C_CUSTOMERLocal File CUSTOMERS [CUST]# Let's create a instance in memory for a customerMY_CUSTOMER = NewInstance C_CUSTOMER AllocGroup Null# Let's read a customer record, and transfer the data in the instance createdRead [CUST]CODE="CUST1234"SetInstance MY_CUSTOMER With [F:CUST]

See also

Structure, Instance, NewInstance, FreeInstance, FreeGroup, allocgrp, cast, null