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)

DateFilter

(0) ShareShare
ReportReport
Posted on by

Hi experts ,

i want to take a report only for expired due date and remaining amount <>0 value i need to take 

i have used this code

SETRANGE("Document Type",custledger."Document Type"::Invoice);
SETAUTOCALCFIELDS("Remaining Amount");
SETFILTER("Due Date",'<%1',WORKDATE,Date2);
SETFILTER("Remaining Amount", '>0');

i got solution (please see below screen shot)

4848.st2.png

but my requirements is  i need to take a expired due date with this date to this date(19/04/2018..09/04/2018)

i have used this code

Date2 := 090418D;
EndDate:= WORKDATE;
Date1 :=190418D;
SETRANGE("Document Type",custledger."Document Type"::Invoice);
SETAUTOCALCFIELDS("Remaining Amount");
SETFILTER("Due Date",'<%1',WORKDATE,Date2);
SETFILTER("Remaining Amount", '>0');

SETRANGE("Due Date",Date2,EndDate);

but im getting this results (please see below screen shot)

st3.png

i want to only red color data with this filter

Date2 := 090418D;
EndDate:= WORKDATE;

SETRANGE("Due Date",Date2,EndDate);

please give any soution.

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    A filter for Due date less than TODAY is:

    SETFILTER("Due Date",'<%1',TODAY);

    P.S. remember that WORKDATE could be different that TODAY.

  • Community Member Profile Picture
    on at

    Hi Stefano,

    Thank yo so much for your quick reply

    i want to set filter

    date1 := 09/04/2018;

    SETFILTER("Due Date",Date1,'<%1',TODAY); //(09/04/2018..19/04/2018)

    but its showing error.

    please give any solution.

    Thank you

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Do you want to set a date filter from Date1 to TODAY?

    Then:

    SETFILTER("Due Date",'%1..%2',Date1,TODAY);

  • Community Member Profile Picture
    on at

    Hi Stefano,

    I want take data from lesser of today date

    if i use like that this is also showing error

    SETFILTER("Due Date",'%1..<%2',Date1,TODAY);

    please see this and give any solution

    Thank you

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    SETFILTER("Due Date",'%1..%2',Date1,CALCDATE('-1D',TODAY));

  • Verified answer
    Andrey Baludin Profile Picture
    3,941 on at

    Also

    SETRANGE("Due Date",Date1,CALCDATE('-1D',TODAY));

    will work

  • alan.butterfield Profile Picture
    on at

    The SETFILTER statement is incorrect because the Filter string '<%1' only contains a single substitution character therefore the variable Date2 is ignored.

    Secondly, the SETRANGE statement on the "Due Date" field removes the filter set by SETFILTER statement

    EndDate := CALCDATE(-1D,WORKDATE) //workdate less 1 day

    Date2 := 090418D

    SETRANGE("Due Date",Date2,EndDate);

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)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans