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

Announcements

News and Announcements icon
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,280 Super User 2026 Season 1 on at

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

  • Suggested answer
    RockwithNav Profile Picture
    9,158 Super User 2026 Season 1 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans