MakeOverwrittenRecord (open)

Supplements or replaces the cells in a record

Syntax

// Core function, no LOADLIB necessary

RECORD FUNCTION MakeOverwrittenRecord(RECORD original, RECORD updatedata)

Parameters

RECORD original

Original record

RECORD updatedata

Record to add or update data in the original record with

Return value

RECORD

The updated record

Description

MakeOverwrittenRecord is a combination of MakeMergedRecord and MakeReplacedRecord, i.e. all cells that are in the original record, but not in the update record are kept as they are, cells that are in the update record but not in the original record will be added, and cells in the original record that are also in the update record will be replaced.

MakeOverwrittenRecord(original,updatedata) is nearly equivalent to [...original,...updatedata] and should be replaced by the later where possible (ie, when no type upcasting/retention is needed)

Examples

MakeOverwrittenRecord( [ a := 1, subrec := [ b := 1, c := 1] ]
                     , [ b := 2, subrec := [ c := 2 ] ] );

// Will return [ a := 1, b := 2, subrec := [ c := 2 ] ];