Filter Date - Less than year

infonoteinfonote Member Posts: 233
Hi,

I am trying to filter a date that is less than a particular date e.g. 2002.
However, it is not working.

I am setting a variable Date.
I am assigning it a date and trying to use SetRange/SetFilter using '<='
However, it is not working.

How do I filter a table to show only entries below that date?

Thanks in advance

Comments

  • BeliasBelias Member Posts: 2,998
    setrange(date,0D,010100D);
    
    OR
    setfilter(date,'..01/01/00'); //use %1 if you prefer, personally i don't like to use it with one parameter only
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    Belias wrote:
    setfilter(date,'..01/01/00'); //use %1 if you prefer, personally i don't like to use it with one parameter only
    

    But this, what you are using, is not correct too... ;-) hardcoded values? :whistle:
    Hi,

    I am trying to filter a date that is less than a particular date e.g. 2002.
    However, it is not working.

    I am setting a variable Date.
    I am assigning it a date and trying to use SetRange/SetFilter using '<='
    However, it is not working.

    How do I filter a table to show only entries below that date?

    Thanks in advance

    May be when you post the part of your code it will be much more descriptive than text.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BeliasBelias Member Posts: 2,998
    kine wrote:
    Belias wrote:
    setfilter(date,'..01/01/00'); //use %1 if you prefer, personally i don't like to use it with one parameter only
    
    But this, what you are using, is not correct too... ;-) hardcoded values? :whistle:
    But this is hardcoded, too :cry:
    setfilter(date,'..%1','01/01/00');
    
    yes, you can substitute the '01/01/00' with a date variable more easily, but it's only one simple line of code...i don't like all these % all around...if there are more parameters, it's another story
    BTW...these are not big problems :mrgreen: let's close an eye on my "hardcoded way" :wink:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    Belias wrote:
    kine wrote:
    Belias wrote:
    setfilter(date,'..01/01/00'); //use %1 if you prefer, personally i don't like to use it with one parameter only
    
    But this, what you are using, is not correct too... ;-) hardcoded values? :whistle:
    But this is hardcoded, too :cry:
    setfilter(date,'..%1','01/01/00');
    
    yes, you can substitute the '01/01/00' with a date variable more easily, but it's only one simple line of code...i don't like all these % all around...if there are more parameters, it's another story
    BTW...these are not big problems :mrgreen: let's close an eye on my "hardcoded way" :wink:

    Yes, I know that it is example, just want to emphasize this for others reading the forum... :mrgreen:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BeliasBelias Member Posts: 2,998
    :thumbsup:
    yes, no problem, i understood: i have to put more smilies :wink:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.