Hi all
I created next code and when i call it from a class is not fill ProdId field on temporal table.
Query q = new Query();
QueryBuildDataSource prodTableQbds;
QueryBuildDataSource prodBOMQbds;
QueryBuildFieldList prodTableFieldList;
QueryBuildFieldList prodBOMfieldList;
Map fieldMapping;
prodTableQbds = q.addDataSource(tableNum(ProdTable));
prodBOMQbds = prodTableQbds.addDataSource(tableNum(ProdBOM));
prodBOMQbds.joinMode(JoinMode::InnerJoin);
prodBOMQbds.relations(true);
prodTableFieldList = prodTableQbds.fields();
prodTableFieldList.addField(fieldNum(ProdTable, ProdId));
prodTableFieldList.addField(fieldNum(ProdTable, bomId));
prodTableFieldList.dynamic(QueryFieldListDynamic::No);
prodBOMfieldList = prodBOMQbds.fields();
prodBOMfieldList.addField(fieldNum(ProdBOM, BOMId));
prodBOMfieldList.addField(fieldNum(ProdBOM, ItemId));
prodBOMfieldList.dynamic(QueryFieldListDynamic::No);
prodTableQbds.addGroupByField(fieldNum(ProdTable, ProdId));
prodTableQbds.addGroupByField(fieldNum(ProdTable, bomId));
prodBOMQbds.addGroupByField(fieldNum(ProdBOM, BOMId));
prodBOMQbds.addGroupByField(fieldNum(ProdBOM, ItemId));
prodTableQbds.addRange(fieldNum(ProdTable, ProdStatus)) .value(queryValue(ProdStatus::StartedUp));
prodTableQbds.addRange(fieldNum(ProdTable, ProdPoolId)) .value(queryValue(prodPoolId));
prodBOMQbds.addRange(fieldNum(ProdBOM, ProdFlushingPrincip)).value(queryValue(ProdFlushingPrincipBOM::Manual));
prodBOMQbds.addRange(fieldNum(ProdBOM, EndConsump)) .value(queryValue(NoYes::No));
if (ProdId)
{
prodTableQbds.addRange(fieldNum(ProdTable, ProdId)).value(queryValue(ProdId));
}
if (filterSpice)
{
prodTableQbds.addRange(fieldNum(ProdTable, DlvDate)) .value(queryRange(fromDate, toDate));
prodTableQbds.addRange(fieldNum(ProdTable, ProductionLineId)).value(queryValue(ProductionLineId));
}
if (ItemId)
{
prodBOMQbds.addRange(fieldNum(ProdBOM, ItemId)).value(queryValue(ItemId));
}
fieldMapping = new Map(Types::String, Types::Container);
fieldMapping.insert(fieldStr(ProdBOMTmp, ProdId), [prodTableQbds.uniqueId(), fieldStr(ProdTable, ProdId)]);
fieldMapping.insert(fieldStr(ProdBOMTmp, BOMId), [prodTableQbds.uniqueId(), fieldStr(ProdTable, BOMId)]);
fieldMapping.insert(fieldStr(ProdBOMTmp, ProdTableBOMId), [prodBOMQbds.uniqueId(), fieldStr(ProdBOM, BOMId)]);
fieldMapping.insert(fieldStr(ProdBOMTmp, ItemId), [prodBOMQbds.uniqueId(), fieldStr(ProdBOM, ItemId)]);
query::insert_recordset(ProdBOMTmp, fieldMapping, q);
if (ItemId)
{
prodBOMQbds.clearRange(fieldNum(ProdBOM, ItemId));
prodBOMQbds.addRange(fieldNum(ProdBOM, bomId)).value(queryValue(ItemId));
}
query::insert_recordset(ProdBOMTmp, fieldMapping, q);
*This post is locked for comments