getModified
This built-in method returns the list of properties that have been modified in an instance since the snapshot has been enabled.
N_MODIFIED=MY_INSTANCE.getModified(NAMES, INDICES1, INDICES2, INDICES3)
The `NAMES` parameter is an array of strings. The method fills it with the names of the modified properties.The INDICES1
parameter is an array of integers. This parameter is optional and is only needed if the instance contains properties of array type.
For each value modified in an array property, the method adds the name of the property to NAMES
and the index of the modified value to INDICES1
.
If several entries are modified in the same array property, the name of the property will appear several times in the NAMES
array and the corresponding values of INDICES1
will give the indices of the modified entries.
The INDICES2
and INDICES3
parameters are two additional optional arrays of integers. They are only relevant if the instance has multi-dimensional array properties, which is a rare scenario. They capture the second and third indices of the modified array entries for the multi-dimensional properties.
# Recomputes a sales order instance if some of its properties have been modified.Local Integer NB, RECOMPUTELocal Char MODIFIED_PROPS(100)(1..), CURPROP(100)# Get modified propertiesNB=MYORDER.getModified(MODIFIED_PROPS)# Check if some specific properties have been modifiedFor CURPROP = "CUSTOMER", "CURRENCY", "PAYMENTTERM", "AMOUNT", "DISCOUNT"If find(CURPROP, MODIFIED_PROPS(1..NB)RECOMPUTE=1BreakEndifNext CURPROP# Recompute if one of the previous properties were modifiedIf RECOMPUTE=1OK=Fmet SORDER.RECOMPUTEEndif
The following is another example with indexes:# Get modified properties on a COMPUTATIONS instance with an array of AMOUNTSLocal Integer NB,ILocal Char MODIFIED_PROPS(100)(1..)Local Integer MODIFIED_INDICES(1..)Local instance COMPUTATION Using C_COMPUTCOMPUTATION=NewInstance C_COMPUT AllocGroup NullFor I=1 to dim(COMPUTATION.AMOUNT)COMPUTATION.AMOUNT(I)=INext I# Enable the snapshotCOMPUTATION.snapshotEnabled=1# Double the amount entries 5 to 7For I=5 to 7COMPUTATION.AMOUNT(I)= 2*COMPUTATION.AMOUNT(I)Next INB=COMPUTATION.getModified(MODIFIED_PROPS,MODIFIED_INDICES)# NB is 3 because 3 entries have been modifiedFor I=1 to NB# MODIFIED_PROPS(I) is "AMOUNT"# MODIFIED_INDICES(I) varies from 5 to 7Next I
If an instance has child instances, references that have been freed or re-allocated will be reported by this method but changes to properties of child instances will not be reported. For all the changes on a graph of instances, you have to walk the graph and call getModified
on every node of the graph.
revertToSnapshot, freeSnapshot, SnapshotEnabled, snapshot, Developer guide Snapshots
SnapshotEnabled, modified