ddMergeResultSet

This function merges a dynamicdata table into an existing result set. If the target result set does not exist, then this function acts exactly like ddLoadResultSet and the target result set is simply created. Otherwise, the merge is performed using the first column of the new result set as the merge key. By default, the merge appends any rows from the new result set that do not match any rows in the existing Idoc Script table, unless the mergeType parameter is set to replace, in which case no new rows are added to the Idoc Script result set.

Note that this merge does not replace all rows matched by a particular row of the new result set, just the first one that it finds. The matching is case-sensitive. The mergeType parameter is optional and defaults to null.

Type and Usage

Parameters

The following table lists parameters for the function.

Parameters Description
dataTableName The name of the dynamicdata table to load.
idocTableName The name of the result set into which the dynamicdata table should be merged.
mergeType The type of merge to perform. Set this to replace to prevent the merge from appending any new rows. Any other value for this parameter is treated as append.
mappingTableName The name of a dynamicdata table which should be used to rename the columns of the final result set. This renaming is done by mapping the column names in this mapping table to the values of the first row in this same table. This is done exactly as it is done in ddLoadResultSet.

Output

If the dynamicdata table is successfully merged, it returns True.

Example

<@dynamicdata MyDataTable@>fieldA, fieldB, fieldC1,      2,       34,      5,       6<@end@>


<$exec rsCreateResultSet("MyResultSet", "fieldA,fieldB,fieldC")$><$exec rsAppendNewRow("MyResultSet")$><$MyResultSet.fieldA = "4"$><$MyResultSet.fieldB = "52"$><$MyResultSet.fieldC = "18"$><$exec ddMergeResultSet("MyDataTable", "MyResultSet", "replace")$><$exec rsFirst("MyResultSet")$><$foo = MyResultSet.fieldB$>    [[% (foo == 52) %]]<$bar = MyResultSet.#numRows$>  [[% (bar == 1) %]]

See Also