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)

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

I have the same question (0)
  • Verified answer
    Zaid Tariq Profile Picture
    2,274 on at

    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

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

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

  • Suggested answer
    RockwithNav Profile Picture
    8,637 Super User 2025 Season 2 on at

    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.

  • ManishS Profile Picture
    86 on at

    You can try below also,

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

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