Comparatives date formula

spnavspnav Member Posts: 7
edited 2008-08-30 in Navision Attain
I am trying to create date filters based on the current and the equivalent previous financial year (ie. 0101..3112) without mentioning the year in the formula. I am using the CALCDATE function but I cannot get a value for 01/01 and its equivalent for the previous year. Can anyone help?

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    The normal way is to use the virtual table date or the accounting period table depending on the context. These will give to the period starts and ends.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • spnavspnav Member Posts: 7
    Can you show me an example ?
  • DaveTDaveT Member Posts: 1,039
    Hi Spnav,

    Declare a variable of datatype record, subtype date/accounting period. Then in the onprereport use
    DateVar.setrange( "period type", "period type"::year );
    DateVar.setrange( "period no.", date2dmy( workdate, 3 ) -1 ); // get last year
    datevar.find( '-' );
    startdate := datevar."period start";
    datevar.next;
    enddate := datevar."period end";
    
    

    In the on predataitem use a setrange( "posting date", startdate, enddate );
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.