Changing the Properties of a Data Class Using a Standard Method
This document provides information on how to use a standard method to change the properties (fields) of a data class from another data class.
The development process described below demonstrates how to add a simple script to a data class (MYCLASS2) to update the properties (MYPROP1) of a different data class (MYCLASS1).
$PROPERTIES
and $METHODS
labels are called in the event. You can also manually enter the running order.# Structure MYCLASS2###########################################METHODS ###########################################$METHODSCase CURPTHWhen ""Case ACTIONWhen "AINSERT_AFTER" Gosub AINSERT_AFTER # Update after insertEndcase EndcaseReturn# Update properties in MYCLASS1 using MYCLASS2$AINSERT_AFTER# Declaration new instance of MYCLASS1 data classLocal Instance MYCLASS Using C_MYCLASS1MYCLASS = NewInstance C_MYCLASS1 AllocGroup NullASTATUS=fmet MYCLASS.AREAD(this.KEY_VALUE)If ASTATUS<>[V]CST_AOKASTATUS = fmet THIS.ASETERROR ("", "Not updated.", [V]CST_AERROR) ARET_VALUE= CST_AFALSEElse# change property values and updateMYCLASS.MYPROP1 = this.MYPROP2ASTATUS=fmet MYCLASS.AUPDATEIf ASTATUS<>[V]CST_AOKASTATUS = fmet THIS.ASETERROR ("", "Not updated.", [V]CST_AERROR) ARET_VALUE= CST_AFALSEElseARET_VALUE= CST_ATRUEEndifEndif# Free instancesFreeGroup MYCLASSReturn