Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

SETRANGE

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I have below line . I want to setrange < StDate

BLLINE.SETRANGE(BLLine."Product Date",StDate);

Thanks

*This post is locked for comments

  • ManishS Profile Picture
    80 on at
    RE: SETRANGE

    You can try below also,

    BLLINE.SETRANGE(BLLine."Product Date",0D,CALCDATE('-1D',StDate);

  • Suggested answer
    RockwithNav Profile Picture
    6,784 on at
    RE: SETRANGE

    Hey,

    You need to use Setfilter instead of Setrange.

    That's the only difference between these two, You can give a more specific filter in Setfilter but not in Setrange, like >, <, =, |, 1..n and all.

    But dont make it a common habit of using Setfilter every where use only where its utmost needed because from performance perspective its slow.

  • Suggested answer
    Suresh Kulla Profile Picture
    47,789 on at
    RE: SETRANGE

    As Zaid mentioned  you need to use SETFILTER in this case but not SETRANGE.

  • Verified answer
    Zaid Tariq Profile Picture
    2,274 on at
    RE: SETRANGE

    Hi,
    Normally the SETRANGE is used when you want the values in a range OR you want the matching values. If you want the values based on comparison, you use the SETFILTER. In your case use the SETFILTER as: 


    BLLINE.SETFILTER("Product Date",'< %1',StDate);

    Thanks

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans