Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Setrange

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

When we apply setrange for customers. How to show from first range to last range through setrange. I tired with CustomerRec.FINDfirst  then its showing 10000 and with findlast its showing 90000. How to show from 10000 to 90000 continuously? Please help me.


CustomerRec.SETRANGE("No.",'10000','90000');
IF CustomerRec.FINDSET THEN
 MESSAGE('%1',CustomerRec."No.")
ELSE
 MESSAGE('Not Found')

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setrange

    Thank you so much guys.

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Setrange

    Hello Madhavi,

    Agree with [tag:Mohana]

    you need to use REPEAT UNTIL

    //CustomerRec.SETRANGE("No.",'10000','90000'); Instead of setrange use setfilter.

    CustomerRec.SETFILTER("No.",'%1..%2','10000','90000');

    IF CustomerRec.FINDSET THEN BEGIN

    REPEAT

      MESSAGE('%1',CustomerRec."No.");

      // Here is your all records.

    UNTIl CustomerRec.Next = 0;

    END ELSE

      MESSAGE('Not Found');

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: Setrange

    you need to use REPEAT UNTIL

    CustomerRec.SETRANGE("No.",'10000','90000');

    IF CustomerRec.FINDSET THEN

     REPEAT

       MESSAGE('%1',CustomerRec."No.");

     UNTIl CustomerRec.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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans