Simple way to insert record list
Just for an example, we need to insert records in a regular table but for temporary purpose.
void method()
{
InventTable inventTable;
InventDimCombination inventDimCombination;
SMCItemPriceTmp itemPriceTmpTable;
RecordInsertList itemPriceTmpTableList = new RecordInsertList(tableNum(SMCItemPriceTmp), false, false, false, false, false, itemPriceTmpTable);
ttsbegin;
itemPriceTmpTable.selectForUpdate(true);
delete_from itemPriceTmpTable;
ttscommit;
while select inventDimCombination
where inventDimCombination.ItemId == inventTable.ItemId
{
itemPriceTmpTable.RetailVariantId = inventDimCombination.RetailVariantId;
ecoResProductMasterDimValueTranslation.clear();
ecoResProductMasterColor.clear();
ecoResProductMaster.clear();
ecoResColor.clear();
inventDim.clear();
select firstonly Description from ecoResProductMasterDimValueTranslation
exists join ecoResProductMasterColor
where ecoResProductMasterColor.RecId == ecoResProductMasterDimValueTranslation.ProductMasterDimensionValue
exists join ecoResProductMaster
where ecoResProductMaster.RecId == ecoResProductMasterColor.ColorProductMaster
&& ecoResProductMaster.RecId == ecoResProduct.RecId
exists join ecoResColor
where ecoResColor.RecId == ecoResProductMasterColor.Color
exists join inventDim
where inventDim.InventColorId == ecoResColor.Name
&& inventDim.inventDimId == inventDimCombination.InventDimId;
itemPriceTmpTable.Description = ecoResProductMasterDimValueTranslation.Description;
itemPriceTmpTableList.add(itemPriceTmpTable);
}
ttsbegin;
itemPriceTmpTableList.insertDatabase();
ttscommit;
}
Happy DAXing...
Just for an example, we need to insert records in a regular table but for temporary purpose.
void method()
{
InventTable inventTable;
InventDimCombination inventDimCombination;
SMCItemPriceTmp itemPriceTmpTable;
RecordInsertList itemPriceTmpTableList = new RecordInsertList(tableNum(SMCItemPriceTmp), false, false, false, false, false, itemPriceTmpTable);
ttsbegin;
itemPriceTmpTable.selectForUpdate(true);
delete_from itemPriceTmpTable;
ttscommit;
while select inventDimCombination
where inventDimCombination.ItemId == inventTable.ItemId
{
itemPriceTmpTable.RetailVariantId = inventDimCombination.RetailVariantId;
ecoResProductMasterDimValueTranslation.clear();
ecoResProductMasterColor.clear();
ecoResProductMaster.clear();
ecoResColor.clear();
inventDim.clear();
select firstonly Description from ecoResProductMasterDimValueTranslation
exists join ecoResProductMasterColor
where ecoResProductMasterColor.RecId == ecoResProductMasterDimValueTranslation.ProductMasterDimensionValue
exists join ecoResProductMaster
where ecoResProductMaster.RecId == ecoResProductMasterColor.ColorProductMaster
&& ecoResProductMaster.RecId == ecoResProduct.RecId
exists join ecoResColor
where ecoResColor.RecId == ecoResProductMasterColor.Color
exists join inventDim
where inventDim.InventColorId == ecoResColor.Name
&& inventDim.inventDimId == inventDimCombination.InventDimId;
itemPriceTmpTable.Description = ecoResProductMasterDimValueTranslation.Description;
itemPriceTmpTableList.add(itemPriceTmpTable);
}
ttsbegin;
itemPriceTmpTableList.insertDatabase();
ttscommit;
}
Happy DAXing...