Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Setrange

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,114 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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans