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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Using a query in Report DP

(1) ShareShare
ReportReport
Posted on by 3,542

I am designing a report. Currently it contains a controller, DP and contract.

In my DP I created a query (and queryRun) in code to select all the relevant records - which ended up to be quite bulky. So I created a query in the AOT with all the relevant datasources and ranges set. (I am new to using AOT defined queries.) I set the ranges on the query by using part method from the contract. So the code looks like this:

Query query = new Query(queryStr(myQuery));

query.findRange(fieldNum(table, field)).value(contract.parmMethod());

QueryRun queryRun = new QueryRun(query);

Which works as I intended it to work. That's all background, here is my question:

1) How does a query get passed around in this general report structure?

  • The menu item has a query parameter
  • The controller has a geFirstQuery and getOriginalQuery method
  • The DP has a SRSReportQueryAttribute property you can set.
  • The DP has a parmQuery method
  • controller args has copyCallerquery method

2) Can I replace the contract class with queryRun.prompt() ? (as the contract only prompts and stores the query ranges) I havent done this before - not sure where to start.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    48,972 User Group Leader on at
    RE: Using a query in Report DP

    I can see your issue is probably taking current record from menu item to pass it to report.

    if so is the case, it can be three steps process.

    1) on your output menu item set datasource of form, that you want to pass as record.

    2) catch and manage args() in controller class. have a look at example named wmsJournalTransController

    3) on your output menu item set controller class rather than setting ssrs report. controller class will call the report.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans