Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Dynamic date filter Query design

Posted on by Microsoft Employee

Hi

I am trying to design a query in NAV with dynamic date filters like T-2M..T for transactions happened in the last 2 months

Also to add is a filter like >=T|'' for documents with a date in the future and where date field in empty

I can'r replicate the NAV sintax when applying filters to the query and thought if using SETFILTER in C\AL

I tried the below

SETFILTER(Ending_Date, '>=%1|%2', TODAY, '');

But it only returns records with Ending date greater and equal to today and it does not show the one with no date

Is this a syntax error?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamic date filter Query design

    Works like a charm!

  • Verified answer
    Hannes Holst Profile Picture
    Hannes Holst 5,767 on at
    RE: Dynamic date filter Query design

    Hi,

    give it try with:

    SETFILTER(Ending_Date, '>=%1|%2', TODAY, 0D);


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!

Community AMA December 12th

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans