Skip to main content

Notifications

Announcements

No record found.

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

Posted on by 100

/// <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

  • Suggested answer
    venu123 Profile Picture
    venu123 100 on at
    RE: 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

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

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: 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

    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
    venu123 100 on at
    RE: 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

    please let me know

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans