DIFFOBJ()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to compare two objects and return the differing properties as an object

Syntax

DIFFOBJ(<object-ref1>,<object-ref2>)

See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, LOADOBJECT(), NEWOBJECT(), OBJECT(), OLDVAL(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SCATTER, SQL SELECT, WITH

Description

The DIFFOBJ() function is used to compare two objects which have the same property names. It returns an object containing only the properties that are different. The <object-ref1> is a reference to the first object to be compared and the <object-ref2> is a reference to the second object. The properites in the returned object will have the same values as <object-ref2>.

The DIFFOBJ() function is particularly useful when combined with the SCATTER command, where current data values and old buffer values have each been saved to an object.

Example

scatter name oNewData
scatter oldvalues name oOldData
oChangedData = diffobj(oNewData, oOldData)