Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

SETRANGE

Posted on by 3,027

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
    ManishS 6,578 on at
    RE: SETRANGE

    You can try below also,

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

  • Suggested answer
    RockwithNav Profile Picture
    RockwithNav 6,562 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
    Suresh Kulla 43,745 on at
    RE: SETRANGE

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

  • Verified answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,266 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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans