Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Set active record for query based report

(0) ShareShare
ReportReport
Posted on by 1,185

I made a query based report n which the report should run for selected record only  like P.O. confirmation report or invoice report..

Please suggest solution .

Regards

Nakul

*This post is locked for comments

  • Verified answer
    Denis Macchinetti Profile Picture
    Denis Macchinetti 16,444 on at
    RE: Set active record for query based report

    Hi Nakul

    If a report have a query as datasource, you can override the method prePromptModifyContract of the controller class and handle the selected record like :

       SalesTable                       salesTable;

       QueryBuildDataSource    qbdsTable;

       salesTable = this.parmArgs().record() as SalesTable;

       if (salesTable)

       {

           qbdsTable = this.getFirstQuery().dataSourceTable(tableNum(SalesTable));

           qbdsTable.clearRanges();

           SysQuery::findOrCreateRange(qbdsTable, fieldNum(SalesTable, SalesId)).value(queryValue(salesTable.SalesId));

       }

    You can also condition the "showQuerySelectButton" method as well.

    You can return false if you have a selected record to avoid that user can changed the query.

    Obviously, when you click the Output button compare a dialog form where you can set the print destination.

    That's it!

  • dolee Profile Picture
    dolee 11,279 on at
    RE: Set active record for query based report

    Hi Nakul,

    Seems impossible. You'd probably need to use RDP instead of AOT query as datasource.

    Regards,

    Dominic Lee

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans