Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)
Posted on by 3,027

Hi

   I want to loop from start date to end date. How I can add 1 to start date till it is equal to end date

Thanks

*This post is locked for comments

  • Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: Loop

    Hi jsshivalik,

    Put the code

    StartDate:=CALCDATE('< +1D >',TODAY);

    inside the REPEAT UNTIL loop.

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Loop

    Hi Chris

      There is one issue . If EndDate = 11/03/2018 . Start Date = 01/03/2018. When i loop according to the above Code it display Data only till 10/03/2018. Since at this Stage Start Date becomes equal to EndDate then it should not go in Repeat Loop which i think so.

    Thanks

  • Verified answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: Loop

    Hi,

    StartDate:=CALCDATE('< +1D >',TODAY); //here I'm adding 1 day to Today's date.

    REPEAT

    //ur code

    UNTILL startdate=ENDdate

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Loop

    Hi

       I want to add 1Day to Start Date till it becomes equal to End Date . In this case i don't want to use Setrange.

    Thanks

  • Suggested answer
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: Loop

    Rec.RESET;

    Rec.SETRANGE(Date,StartDate,EndDate);

    IF Rec.FINDSET THEN

    REPEAT

    //Loop

    UNTIL Rec.Next = 0;

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans