web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Loop

(0) ShareShare
ReportReport
Posted on by 3,099

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

I have the same question (0)
  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    Rec.RESET;

    Rec.SETRANGE(Date,StartDate,EndDate);

    IF Rec.FINDSET THEN

    REPEAT

    //Loop

    UNTIL Rec.Next = 0;

  • jsshivalik Profile Picture
    3,099 on at

    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

  • Verified answer
    CDsilva Profile Picture
    4,188 on at

    Hi,

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

    REPEAT

    //ur code

    UNTILL startdate=ENDdate

  • jsshivalik Profile Picture
    3,099 on at

    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

  • Olister Rumao Profile Picture
    3,967 on at

    Hi jsshivalik,

    Put the code

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

    inside the REPEAT UNTIL loop.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans