最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Data manipulation tip 4 Dynamics ax 2012 and D365 of Operations Insert_recordset

网络文摘 alirazazaidi 2174浏览 0评论

During report development we populate temp table and bind it to SSRS report. And most of the time we were doing one to one mapping inside while loop or query run loop., Kindly consider following code snippet.

While select sum(Qty) from Inventtrans group by 
ItemId, InventDimId , DatePhysical
Where datePahyical > _fromdaet
&& datePhayical <_todate
{
Tmp.ItemId= inventrans.ItemId;
Tmp.IventDim = inventtrans.InventId;
Tmp.Qty = inventtrans.QTY;
Tmp.Insert();

}

But if we replace loop with Insert_RecordSet , report execution time reduce much. Consider following code snippet used to replace loop with Insert_Recordset

Insert_recordset Tmp (ItemId,InventdimId,QTY)
Select forceplaceholders ItemId, InventDimId, sum(QTY)
From inventtrans
Group by ItemId,InventDimId
Where datePahyical > _fromdaet
&& datePhayical <_todate;
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址