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)

AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

(0) ShareShare
ReportReport
Posted on by 70

I have a Customized report with Contract, Controller and DP class with parameters. It works fine when I open Controller class (or from its associated Menu Item) it brings up the Dialog box with intended parameters pre-populated. The report runs fine too with those parameters.

The issue is, when I schedule it as a Batch Job the parameters become static. How can I make it dynamics (i.e Current date) when the batch job runs on schedule?

Controller-Batch-Job-1.png

Controller-Batch-Job-2.png

Any help will be appreciated much.!

(Please let me know if you need more info regarding this que.)

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    47,776 User Group Leader on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Seems your email id will change from case to case.

    args is powerful, you can pass container and on other side you can get whatever you want. you can pass almost anything in args, such as a record, etc.

    But i like here Matin's solution, more than mine, in this case.

  • Ronak Brahmbhatt Profile Picture
    70 on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Hi Sohaib,

    I think it is a good idea to move forward with RunBaseBatch and have my all parameter logic in Code.

    By the way, I don't see any issue but can I keep 'To email' as my Batch Job parameter in that case like following?

    • Write a class that extends to RunBaseBatch
    • Write a code that run the report with intended parameters logic in the Run method
    • Pass 'emailTo' parameter as arg

    I appreciate your input on this.

    Thanks,

    Ronak

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    If you merely use the dates to set query ranges, maybe you should expose the query in the contract (and dialog). Then user can use not only fixed values, but also functions interpreted at runtime, such as (current Date()).

    If you want to keep parameters, you still have quite a few options. For example, you could have a flag in the contract indicating that current date should be used by the RDP class (you should also disable the date parameters in your UI builder if the flag is active). A separate controller setting the dates (as you suggested) is also a possibility.

  • Sohaib Cheema Profile Picture
    47,776 User Group Leader on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    In worst case:

    Do not add report in batch. think and you can find many solution. for example a though i can share with you.

    1) write a call extends runbasebatch

    2) inside processing of class, call report by code.

    3) now when you are calling report by code(x++), you can manipulate parameters in any way. By saying 'manipulate' i mean, you can pass values of parameters on run-time using x++ code.

    4) Add your newly created class in batch 

  • Ronak Brahmbhatt Profile Picture
    70 on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Hi Martin,

    Thanks again for taking time on this.

    So.. yes..Users can change the date as if they want on demand. It should populate the date default with current date but they can change the date as needed/

    I can create separate logic (like separate controller class) for run as batch job if we need. But need some direction on it.

    I hope it was little more clear this time.

    Thanks again.

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    I would like to clarify the expected behaviour before talking about implementation details.

    Can you please address my previous question?

  • Ronak Brahmbhatt Profile Picture
    70 on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Hi Martin,

    So.. the requirement emailing a report with set parameters (i.e. current date) like 'email' as Print Destination.

    I know this can be done.. I am missing something like:

    Controller Class /  Run Method: Is InBatch / Is Batchable then use some logic.? (hope it is  in right direction)

    Or can you guys think of any other possibility emailing the report on daily basis other than from batch job?

    Just once again: This Report has its own DP, Contract and Controller Class in place.

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Does it mean that users will be allowed to change dates, but these days will be ignored if they tick "Batch processing" (e.g. because it would take too much time and they want the run it overnight)? It would be strange user experience...

    I think you should distinguish this case from the one when the logic should run for the current date only.

  • Ronak Brahmbhatt Profile Picture
    70 on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    Thanks Sohaib for your reply.  Just to make sure, I can initialize those dates (i.e. Sysdate) fine when you manually click on Menu Item of Controller. It loads with intended date parameter.

    The issue is, this doesn't work when in Batch Job.

  • Suggested answer
    Sohaib Cheema Profile Picture
    47,776 User Group Leader on at
    RE: AX SSRS Controller Class: Keep Parameters dynamics while in Batch Job

    You need to do two things

    1) In your controller class under main method set a line of code as under

    ObjectOfYourControllerClass.parmLoadFromSysLastValue(false);

    2) In your contract class use the method initialize to set values of from and to date parameter.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans