Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Execute a report and end up with different results

Posted on by Microsoft Employee

Hey guys,

I have a report and for that I have created a start date filter and an end date filter. Predefined start date filter 01.01.2016 and end date is today.

In my test system it filters the correct times also if I change my predefined filters, then I get the right result let's say for the year 2019.

In my productive system, I can also change the predefined report filters but, when I run then my report, I get again the results from the time between my predefined start date filter and end filter (01.01.206 & today?!

How can this be?

Wjy is working in the test system, but no in the productive systems, even if the report is the same object in both systems?!

Thank you ;)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Execute a report and end up with different results

    There is no real action, it works through a request page. The start date and the end date are filled automatically with default values. The values are calculated in the request page (first part of the code). Now I would like to be able to change the default dates, because I do not need all the time a filtering over 4 year, let's say I want to filter only the year 2019. So I can change the default values in the filters. Then I say print and on the report I have again in the filter criteria, which are also printed there, my old default filter values over the 4 years, but not the changed ones. That is my problem, so I think the new filters I have given in to the request page are not updated through my code. That's why I thought I have to add the above function "InitializeRequest". But I do not know how...

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Execute a report and end up with different results

    So the action is calling the function to set the dates, did you add any code to call the report? And what dates should want to pass to the report?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Execute a report and end up with different results

    I have still have the problem, because I do not know, how to add the code and to which trigger...

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Execute a report and end up with different results

    So I assume you resolved your issue? or are you still having the issues

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Execute a report and end up with different results

    I found out, that I get only different results, when I execute the report via my action and directly through running the report from c/side.

    I had a look to my request page:

    CEntry.SETCURRENTKEY("Posting Date");

    IF CEntry.FINDFIRST THEN

    StartDate := CALCDATE('<-CY>',CEntry."Posting Date");

    EndDate := WORKDATE;

    That is the code, I execute there.

    This means, that always when the user executes the report via the action, it opens the request page and then there are the predefined filters.

    When the user changes the filters, the report will be filtered again with the predefined filters.

    I found a function, maybe that one I can add to the above code:

    pastedimage1580828213330v1.png

    Here are new start dates and end dates set…

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Execute a report and end up with different results

    Try to compile the report again, unless there is any other condition in your report based on the data and which may not match with ur test system, It could ur data.

    Try to provide more information about the issue.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans