Skip to main content
Business Central forum
Suggested answer

Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

editSubscribe (0) ShareShare
ReportReport
Posted on by 350

I want, every week, to schedule the "Able to Make (timeline)" report for the next 10 Weeks.

how do i get the Start Date field to change to the current day on each scheduled report run?

pastedimage1641851309568v1.png

  • jberm81 Profile Picture
    jberm81 5 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Did this solution work?

  • benovic Profile Picture
    benovic 350 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Thanks for this!

    i went another route, i copied the complete .al files and the .rdl in my extension and changed two parts, once the layout -> options part and once this::


        procedure Initialize(NewStartingDate: Date; NewDateInterval: Option; NewNoOfIntervals: Integer; NewShowDetails: Boolean)
        begin
            //StartDate := NewStartingDate; // change this to WorkDate always (we commented this out in Options Layout)
            StartDate := WorkDate;
            DateInterval := NewDateInterval;
            NoOfIntervals := NewNoOfIntervals;
            ShowDetails := NewShowDetails;
        end;
    i can run and schedule the new report, tomorrow i know if it actually works :)
  • Suggested answer
    MahGah Profile Picture
    MahGah 15,395 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Hi

    You are welcome. Sorry I am not developer and have no knowledge here. 

    See below example 

    https://www.integrated.ee/posts/business-central-job-queue-parameters/

    cloudblogs.microsoft.com/.../

    I think based on the below article also it is possible that you create codeunit and pass the string to it. Which means you even do not need to deal with report. Possibly you can create a codeunit, schedule it in job queue,  then codeunit reads the parameter and pass it to report. 

    docs.microsoft.com/.../reportinstance-runrequestpage-method

  • benovic Profile Picture
    benovic 350 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Hi MahGah,

    thanks alot for your extensive check!

    i am currently looking into reportextension, but i think it is not straight forward.

    since it is a scheduled report, i don't know if "requestpage" is even right here since the actual page is not opened.

    i cannot find a practical example for your "Parameter String to populate fields" example. Can you maybe link me somewhere where i can documentation and an example on how to use this?

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,395 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Hi

    My test failed. I checked again with some other people and they said you may need to do what you mentioned. Also, they said you can use Parameter String to populate fields. For example in parameter string you can enter CW or T and then in extension refer to this

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,395 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Hi

    I am not sure. I scheduled the report in our environment to see if Job Queue auto adjust the date. These are my steps (I used T). I will keep you posted tomorrow. 

    pastedimage1641856274555v1.png

    pastedimage1641856302561v2.png

    pastedimage1641856418134v3.png

  • benovic Profile Picture
    benovic 350 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    if this is just not possible vie UI,

    would it be feasible to change this with a report extension?

    something

    if start date < WORKDATE

    then start date = WORKDATE

  • benovic Profile Picture
    benovic 350 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    if i input anything like T or CW, the string is replaced by the date value immediately, before saving the report. this does not work alas

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,395 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    Hi

    Try T in date. Then I assume every time report run it will use the current dat. Do you try to use Send To in report then Schedule then set the next run something like 1D? I mean I believe that is the only time if you use T it works.

  • benovic Profile Picture
    benovic 350 on at
    RE: Scheduled Reports - how to enter relative starting dates for date ranges (e.g. on able-to-make report)?

    leaving the start date field blank, i get this when i try to run the report:

    pastedimage1641851675366v1.png

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans