Date Filter options

WashoutWashout Member Posts: 24
Hi,

I am writing a report and setting a Date Filter.

however in my code I have


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

This works for the following
05/05/08
05/05/08..30/06/08

Is it possible to write the code so that I can also use it for the following
<05/05/08
>05/05/08

Also

If :I have an option field on a table and I want to setrange on 2 specific options. how is it done?


hoping you can help

Comments

  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    for All dates (before stratDate OR after Enddate)
    SETFILTER("Order Date",'<%1|>%2',StartDate,EndDate);


    for (all dates Not equal to StartDate)
    SETFILTER("Order Date",'<>%1',StartDate);
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • WashoutWashout Member Posts: 24
    for All dates (before stratDate OR after Enddate)
    SETFILTER("Order Date",'<%1|>%2',StartDate,EndDate);


    for (all dates Not equal to StartDate)
    SETFILTER("Order Date",'<>%1',StartDate);

    but when the user runs the report.
    how can we check which option the user entered into the date filter?
    example if user types >310608
    how does the code know that thats what he typed?
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    how does the code know that thats what he typed?
    It can be done without writing a single line code.... :idea:



    filters can be applied on fields by setting field(s)'s name in [ReqFilterFields] property of the dataItem of report.
    there user can input all combination of date filters. how to input the date filter..?? Please see help. :wink:
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • DaveTDaveT Member Posts: 1,039
    Hi Washout
    Washout wrote:
    how does the code know that thats what he typed?

    You can get (and then print) what is filtered by using the GETFILTER function which returns a string of the filter. To set a filter you can do as Sandeep suggests

    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • awarnawarn Member Posts: 261
    Run report 3, and look at the last filtering option. It is a flowfilter called Date Filter. There the user can enter whatever they want, and you can use

    correctfitlerstring := GETFILTER("Date Filter");

    If you have added a field to the options tab that is a date filter, consider instead adding a flowfilter to your table, called Date Filter, and then using the above code to properly filter by date. It is a lot easier because Navision does the work for you.

    -a
Sign In or Register to comment.