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)

Date Filter as range on the request page

(0) ShareShare
ReportReport
Posted on by

Hello community,

I'm trying to apply filters to a custom report. I'm struggling with Date filter as range. In the past what I have done is create two global variables: StartDate and EndDate both as Date variables. Then I simply apply a SETRANGE filter: SETRANGE("POSTIND DATE", StartDate, EndDate) and that works ok.

However, NAV 2013 R2 has this behavior where you can simply tipe 01052015..31052015 and it will apply a date format. That what I'm tryint to accomplish. I already know that I would have to use SETFILTER instead of SETRANGE to start with.

Any suggestions or any directions to the right place would be greatly appreciated. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Will,

    If you want to use that format you have to use SETFILTER

    Example:

    SETFILTER("Posting Date",'%1..%2',StartDate,EndDate);

  • Community Member Profile Picture
    on at

    Thank you for your answer Suresh, what I'm trying locates on the request page. Below more detail information.

    6014.Captura2.PNG

    As you can see in the picture above, I'm trying to type the dates in range like 01052015..31052015 to only request one input from the user. This to avoid having multiple boxes asking just for dates.

    If I do this on the G/L Register page i get this:

    6014.Captura2.PNG  Captura3.PNG

    Navision complety understand that I have input two dates. That what I'm trying to accomplish if possible.

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

    What is the source expression for the Request page Date Filter, is it a variable if so what is the datatype ? If the data type is Date then it should be good, i think there may be validation added on the validation of the field on the request page to check the format. Please check if there is any code.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,003 Super User 2025 Season 2 on at

    Please check the Data type of the Dates variable. It should be of Type Text and you have to use GETRANGEMIN and GETRANGEMAX functions to get those range of dates.

  • Suggested answer
    jcastro Profile Picture
    2,245 on at

    Hello,

    You should find a specific function in codeunit 1 specifically designed for this:

    Check this code:

    Variables used: 

    • AppMgt: Codeunit 1

    FormatTextDateFilter(TxtDate : Text[30])
    AppMgt.MakeDateFilter(TxtDate);

    MESSAGE(TxtDate);

  • Community Member Profile Picture
    on at
  • Community Member Profile Picture
    on at

    deleted

  • Suggested answer
    Mohana Yadav Profile Picture
    61,003 Super User 2025 Season 2 on at

    Did you try without using Codeunit 1?

    Just a text variable and insert the date.

    get the dates using GETRANGEMIN and GETRANGEMAX ?

  • Suggested answer
    jcastro Profile Picture
    2,245 on at

    Hello Williams,

    FormatTextDateFilter is a function I created. You can use the code inside it. If you want to use the name of the function that works too :)

    This way TxtDate can have the value '010101..311201' and it will be transformed to what you expect.

  • Suggested answer
    jcastro Profile Picture
    2,245 on at

    Let me attach a screenshot with the example:

    Function:

    3326.Captura2.PNG

    Call the function from the object:

    3326.Captura2.PNG

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