User filtering Date

sabzam
sabzam Member Posts: 1,149
Dear All,

I have got a client who needs to filter the entries by filtering out the all the dates which are dated as december; irrespective from the year. How can this be done?

Comments

  • Belias
    Belias Member Posts: 2,998
    I doubt you can do it with filters...but you can use DATE2DMY function to return the month, test every line and discard those you don't want
    IF DATE2DMY("My Table"."My Date Field",2) = INTMyMonth THEN
      "My Table".MARK(true);
    
    then use markedonly(true);
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Belias
    Belias Member Posts: 2,998
    I doubt you can do it with filters...but you can use DATE2DMY function to return the month, test every line and discard those you don't want
    IF DATE2DMY("My Table"."My Date Field",2) = INTMyMonth THEN
      "My Table".MARK(true);
    
    then use markedonly(true);
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Fordewind
    Fordewind Member Posts: 27
    Hi,

    You may use DATE2DMY function for MARK records and then show MARKEDONLY
    Nav 4.0 sp3
  • sabzam
    sabzam Member Posts: 1,149
    I need it to be done through the normal user filter and not through codeunit
  • Belias
    Belias Member Posts: 2,998
    ok, you can add a button and a txtbox in the form, the user insert month no. in the txtbox and then click the new "Filter" button. From the button you can run the code...
    it's the only way I can figure this out (can I say "figure this out" in english? :mrgreen: )...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • NaviDev
    NaviDev Member Posts: 365
    For better performance, You can filter first the records rather than going to the lines one by one (what if you a very huge number of lines) then mark the results one by one.

    You may use the table Date for your filtering purposes, just filter the field Period Type with Month, filter the starting date, Then retrieve and use the starting date and ending date as your filterings. :D
    Navision noob....