web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How can we write insert_recordset() on behalf of recordset for following is it possible by this does performance improve of the report? or is it properly written have they followed best practices ? please let me know

(0) ShareShare
ReportReport
Posted on by 138

/// <summary>
/// Adds lines of opening balances as current balance to include in summary report.
/// </summary>
protected void addOpenBalToInvtStockCardTmpLineSummary()
{
QueryRun queryRun;
InventValueReportUnionAll inventValueReportUnionAll;
InventTable inventTable;
InventDim inventDim;
InventTrans inventTrans;
InventModelGroup inventModelGroup;
InventTableModule inventTableModule;

//
// Openning balance
//
queryRun = new QueryRun(this.getContract().buildDetailQueryForOpeningBalance());

while (queryRun.next())
{
inventValueReportUnionAll = queryRun.get(tableNum(InventValueReportUnionAll));
inventTrans = queryRun.get(tableNum(InventTrans));
inventDim = queryRun.get(tableNum(InventDim));
inventTable = queryRun.get(tableNum(InventTable));
inventModelGroup = queryRun.get(tableNum(InventModelGroup));
inventTableModule = queryRun.get(tableNum(InventTableModule));

inventStockCardTmpLine.clear();

inventStockCardTmpLine.LineType = InventValueReportLineType::CurrentBalance;
inventStockCardTmpLine.BalanceAmount = inventValueReportUnionAll.Amount;
inventStockCardTmpLine.BalanceQty = inventValueReportUnionAll.Qty;
inventStockCardTmpLine.ItemName = inventTable.itemName();
inventStockCardTmpLine.ItemId = inventValueReportUnionAll.ItemId;
inventStockCardTmpLine.SiteId = inventDim.InventSiteId;
inventStockCardTmpLine.LocationId = inventDim.InventLocationId;
inventStockCardTmpLine.WmsLocationId = inventDim.wmsLocationId;
inventStockCardTmpLine.InventModel = inventModelGroup.InventModel;
inventStockCardTmpLine.UnitId = inventTableModule.UnitId;
if (this.getContract().parmGroupByItemGroup())
{
inventStockCardTmpLine.ItemGroupId = InventTable::find(inventValueReportUnionAll.ItemId).itemGroupId();
}
inventStockCardTmpLine.insert();
}
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    venu123 Profile Picture
    138 on at

    please let me know

  • Suggested answer
    Sukrut Parab Profile Picture
    71,735 Moderator on at

    I don't see anything wrong with the code . There are multiple ways to write query for report  .  In your case you are getting it from some predefined query and iterating through it. If you are facing performance issues you could convert it to insert_recordset query as well.  

  • Suggested answer
    venu123 Profile Picture
    138 on at

    how can i change can you give example for the code?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans