ddMergeUsingIndexedKey

This function pulls selective rows from a dynamicdata table and use them to replace particular row values in a target result set. The values of a particular column in the target result set are used as values for an index look up into the dynamicdata table. The sub table retrieved is used to replace column values in the target result set that have matching column names. The dynamicdata table is assumed to have only one row in the sub table selected out by the index value. If it has more than one row, only the first row is used to merge in values into the target result set.

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.
indexColumn The name of an indexed column in the dynamicdata table and the name of the column in the target result set from which values are retrieved to select out sub tables in the dynamicdata table.
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@><?commatable indexedColumns="fieldA"?>fieldA, fieldB, fieldC1,      2,       34,      5,       67,      8,       9<@end@>


<$exec rsCreateResultSet("MyResultSet", "fieldA,fieldB,fieldC")$><$exec rsAppendNewRow("MyResultSet")$><$MyResultSet.fieldA = "4"$><$MyResultSet.fieldB = "8"$><$MyResultSet.fieldB = "23"$> <$exec rsAppendNewRow("MyResultSet")$><$MyResultSet.fieldA = "7"$><$MyResultSet.fieldB = "20"$><$MyResultSet.fieldB = "41"$><$exec rsAppendNewRow("MyResultSet")$><$MyResultSet.fieldA = "8"$><$MyResultSet.fieldB = "21"$><$MyResultSet.fieldB = "59"$><$exec ddMergeIndexedColumnResultSet("MyDataTable", "MyResultSet", "fieldA")$><$exec rsFirst("MyResultSet")$><$foo = MyResultSet.fieldB$>    [[% (foo == '5') %]]<$exec rsNext("MyResultSet")$><$bar = MyResultSet.fieldC$>    [[% (bar == '9') %]]<$exec rsNext("MyResultSet")$><$bar = MyResultSet.fieldC$>    [[% (bar == '59') %]]