Skip to main content

Notifications

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

Backward scheduling and forward scheduling considering non-working days

Posted on by 144

Hi,

In my own code I need to do backward scheduling and forward scheduling considering non-working days based on the DateFormula-Field Item."Lead Time Calculation"
Is there a simple standard function I can use for this.

Thanks in Advance
Ralf

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 72,895 Super User 2024 Season 2 on at
    RE: Backward scheduling and forward scheduling considering non-working days

    Hi, have you investigated codeunit 7600 "Calendar Management"?

    For example,

    pastedimage1667781888907v1.png

    pastedimage1667781938318v2.png

    Hope this can give you some hints.

    Thanks.

    ZHU

  • neckit Profile Picture
    neckit 144 on at
    RE: Backward scheduling and forward scheduling considering non-working days

    The base calendar is assigned and I have indicated what are working days and what are not working day.

    But I have trouble recognizing and using the help function in the CU 7600. My code below works correctly but is very inefficient, so I would like to use this helper function. Could I get an example of forward and backward scheduling?

    procedure fnCalculateDateBackward(parDueDate: Date; parDateformula: DateFormula) StartDateL: Date
    var
        NumerOfDaysL: Integer;
        I: Integer;
    begin
        StartDateL := parDueDate;
        NumerOfDaysL := (CalcDate(parDateformula, 20010101D) - 20010101D);
    
        for I := 1 to NumerOfDaysL do begin
            StartDateL := CalcDate('<-1D>', StartDateL);                
            if CalenderMgmtG.IsNonworkingDay(StartDateL, CustomizedCalenderChange) then begin
                I := I - 1;
            end;
        end;        
    end;

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Backward scheduling and forward scheduling considering non-working days

    You should start by setting up a base calendar were you indicate what is working days and what are not working days.

    Then you take that calendar into considerations when you do your calculation.

    learn.microsoft.com/.../across-how-to-assign-base-calendars

    Then you have  codeunit 7600 "Calendar Management" that have some helper function that can help you find the next working day etc.

  • DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: Backward scheduling and forward scheduling considering non-working days

    hi

    look this

    robertostefanettinavblog.com/.../

    learn.microsoft.com/.../dateformula-data-type

    DAniele

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,908 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans