Martin, I tried commenting the lines but the funny part is as of now with the current code it likes only one of the columns doesn’t matter which one. I have tried commenting one after the other and it only takes one column. I want to use the Query::Insert_Recordset so I can build ranges as I needed dynamically based on what user has selected. I don’t have the flexibility in the regular insert_RecordSet set based operation. Here is the code
public static MASProdActionFutureMarkedTmp insertMASProdActionFutureMarkedTmp(TmpSysQuery _tmpSysQuery)
{
MASProdActionFutureMarkedTmp masProdActionFutureMarkedTmp;
Query query = new Query();
QueryBuildDataSource qbdsProdTable;
QueryBuildDataSource qbdsInventDim;
Map targetToSourceMapping;
str rowCount;
QueryBuildFieldList prodFieldList, inventDimFieldList;
//delete_from masProdActionFutureMarkedTmp;
query.clearAllFields();
qbdsProdTable = query.addDataSource(tableNum(Prodtable));
prodFieldList = qbdsProdTable.fields();
prodFieldList.dynamic(1);
//qbdsProdTable.addSelectionField(fieldNum(ProdTable, ProdId));
qbdsProdTable.addSelectionField(fieldNum(ProdTable, ItemId));
//qbdsProdTable.addSelectionField(fieldNum(ProdTable, InventDimId));
while select _tmpSysQuery
{
if(_tmpSysQuery.Tablelabel == 'ProdTable' && _tmpSysQuery.RangeValue)
{
qbdsProdTable.addRange(_tmpSysQuery.Field_Id).value(_tmpSysQuery.RangeValue);
}
}
//qbdsInventDim = qbdsProdTable.addDataSource(tableNum(InventDim));
//qbdsInventDim.relations(true);
////qbdsInventDim.addLink(fieldNum(ProdTable, InventDimId), fieldNum(InventDim, InventDimId));
//inventDimFieldList = qbdsInventDim.fields();
//inventDimFieldList.dynamic(1);
//qbdsInventDim.addSelectionField(fieldNum(InventDim, ConfigId));
//qbdsInventDim.addSelectionField(fieldNum(InventDim, InventcolorId));
//qbdsInventDim.addSelectionField(fieldNum(InventDim, InventsizeId));
//qbdsInventDim.addSelectionField(fieldNum(InventDim, InventStyleId));
//
//
//
//while select _tmpsysquery
//{
//if(_tmpsysquery.tablelabel == 'inventdim' && _tmpsysquery.rangevalue)
//{
//qbdsinventdim.addrange(_tmpsysquery.field_id).value(_tmpsysquery.rangevalue);
//}
//}
targetToSourceMapping = new Map(Types::String, Types::Container);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, ProdId), [qbdsProdTable.uniqueId(), fieldStr(ProdTable, ProdId)]);
targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, ItemId), [qbdsProdTable.uniqueId(), fieldStr(ProdTable, ItemId)]);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, InventDimId), [qbdsProdTable.uniqueId(), fieldStr(ProdTable, InventDimId)]);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, ConfigId), [qbdsInventDim.uniqueId(), fieldStr(InventDim, ConfigId)]);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, InventColorId), [qbdsInventDim.uniqueId(), fieldStr(InventDim, InventColorId)]);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, InventSizeId), [qbdsInventDim.uniqueId(), fieldStr(InventDim, InventSizeId)]);
//targetToSourceMapping.insert(fieldStr(masProdActionFutureMarkedTmp, InventStyleId), [qbdsInventDim.uniqueId(), fieldStr(InventDim, InventStyleId)]);
ttsBegin;
Query::insert_recordset(masProdActionFutureMarkedTmp, targetToSourceMapping, query);
ttsCommit;
rowCount = strFmt('%1', masProdActionFutureMarkedTmp.rowcount());
info(strFmt('row count : %1', masProdActionFutureMarkedTmp.rowcount()));
return masProdActionFutureMarkedTmp;
}
Where TmpSysQuery has all the parameters that users had selected. I want to be able to loop through it and add them to the query and pass it to the Query::Insert_Recordset.
here is what users select for instance