Date Filter values

petevanspetevans Member Posts: 78
You can put the following into a date flowfilter:

T = Today
Y = This Year
T-1 = Yesterday
Y-1 = Last Year
Y+1 = Next Year
etc.

A, M and C all translate into dates as well, but I am not clear which.

Does anyone have an overview of the available commands (Letters and valid operators) for date flowfilters, or could point me towards some documentation? So far my search has been fruitless.

Cheers.
NAVN00b

Comments

  • ara3nara3n Member Posts: 9,256
    The date expression can be any length. The string is interpreted from left to right with one subexpression at a time. The following rules describe the valid syntax of date expressions:

    DateExpression = [<SubExpression>][<SubExpression>][<SubExpression>]

    <SubExpression> = [<Sign>] <Term>

    <Sign> = + | -

    <Term> = <Number><Unit> | <Unit><Number> | <Prefix><Unit>

    <Number> = Positive integer

    <Unit> = D | WD | W | M | Q | Y (D=day, WD=weekday, W=week, M=month, Q=quarter, Y=year)

    <Prefix> = C (C=current)

    These production rules show that date expressions consist of zero, one, two, or three subexpressions. Each subexpression comprises an optional sign and a term. The following are some typical examples of terms:

    30D (30 days; corresponds to <Number><Unit>)

    WD2 (weekday number 2; corresponds to <Unit><Number>)

    CW (current week; corresponds to <Prefix><Unit>)

    The internal calendar of C/SIDE starts on Monday and ends on Sunday. This means that Monday is weekday 1 and Sunday is weekday 7.

    A run-time error occurs if the syntax of DateExpression is incorrect.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • petevanspetevans Member Posts: 78
    Hello and thanks for your reply.

    I am not getting some of the commands you listed to work.

    CW, 30D, D, to name some - all yield "<expression> is not a valid date" when I enter them in a date flowfilter in a table.

    Some of them work though, like T (Today) and Y (Translates into 01.01.10..31.12.10).

    I understand this is language dependent though, and my results listed above are in ENU (English (USA)). When I change to Norwegian, D does work, and replaces T as today's date.

    I am still a bit confused. CW would have been a great command for my purposes, especially if I could use -CW (Last week) as well.
    NAVN00b
  • matttraxmatttrax Member Posts: 2,309
    Lookup CALCDATE or DateFormula in the NAV Help Menus. You should find your language dependent commands there.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    There are two different topics being discussed here.

    One is the C/AL function CALCDATE and how to build up a Calcdate formula.

    The second is Date SHORTCUT keys these are hortcuts that can be used in the Client interface to indicate a specific date that can be used.

    It is purely coincidence that some of the symbols used are valid in both, even though they may mean something else.

    For example, in Calc date, Friday is indicated as WD5 but the shortcut for Friday in a date field is F


    On top of this there is a bug in the shortcuts, where in the STX file letters were used twice, such as T. So T can mean Today or Tuesday and W can mean Wednesday or Workdate. To complicate this even further, the W T issue is interpreted differently between T.. and >=T (can't remember which is which, but one uses Today and one Tuesday), same with W.

    Actually this one is great because you normally get a call on a Wednesday where the customer says "But T worked yesterday as today but doesn't work today (because actually it was Tuesday).

    In fact they STX compiler should giv an error when it finds language clashes like this. Days of the week should use two or three letters Mo,Tu,We or MOn, Tue, Wed, to avoid this issue.
    David Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    petevans wrote:
    You can put the following into a date flowfilter:

    T = Today
    Y = This Year
    T-1 = Yesterday
    Y-1 = Last Year
    Y+1 = Next Year
    etc.

    A, M and C all translate into dates as well, but I am not clear which.

    Does anyone have an overview of the available commands (Letters and valid operators) for date flowfilters, or could point me towards some documentation? So far my search has been fruitless.

    Cheers.

    So lets answer your actual question.

    (assuming English STX file)

    T = Today
    W =Workdate
    P = Accounting Period
    Q = Quarter
    Y = Year
    M = Month
    C= Closing

    A I have no idea what that is. It might be a local language thing.
    David Singleton
  • klavinklavin Member Posts: 117
    T = Today
    W =Workdate
    P = Accounting Period
    Q = Quarter
    Y = Year
    M = Month
    C= Closing

    Has anyone else ever noticed the bug every once in a while that entering T in a date field returns Tuesday's date (when it's not Tuesday), and not the system date? I see it every once and a while and it aggravates me haha. Just curious if anyone else has ever seen it

    Lavin
    -Lavin
    "Profanity is the one language all programmers know best."
  • David_SingletonDavid_Singleton Member Posts: 5,479
    klavin wrote:
    T = Today
    W =Workdate
    P = Accounting Period
    Q = Quarter
    Y = Year
    M = Month
    C= Closing

    Has anyone else ever noticed the bug every once in a while that entering T in a date field returns Tuesday's date (when it's not Tuesday), and not the system date? I see it every once and a while and it aggravates me haha. Just curious if anyone else has ever seen it

    Lavin

    Sometimes T=Thursday. I think its like entering the years, eg 89 = 1989 22 = 2022 so there is a cut off some how.

    As I said it should need at least two letters to enter a day that would make it easier
    David Singleton
Sign In or Register to comment.