mergeDataRecords

DataRecord sutil.mergeDataRecords ( DataRecord first, DataRecord second, boolean saveNonEmptyString ) (professional and enterprise editions only)

Description

Merges two data records by copying all values from the second record over values of the first record, and returning a new DataRecord with these values. Doesn't modify either original record

Parameters

  • first The first DataRecord, into which the values from the second record will be copied
  • second The second DataRecord, whose values will be copied into the first
  • saveNonEmptyString True if blank values should not overwrite blank values, whether the non-blank value is in the first or second record. If both records contain a value that is not blank for the same key, the value in the first record is saved and the value in the second record discarded. If false, all values in the second record will overwrite any values in the first record.

Return Values

A new DataRecord with the merged values

Change Log

Version Description
5.5.26a Available in all editions.

Examples

Combine values from the current dataRecord with a previous one

 DataRecord previous = session.getVariable("_DATARECORD");
 
 session.setVariable("_DATARECORD", sutil.mergeDataRecords(previous, dataRecord));