Historical Dates in a report...

aaranaaran Member Posts: 10
I have written a report to show all Purchase Order Lines that have an 'Outstanding Quantity' greater than 0 and an 'Expected Receipt Date' of more than two days ago...

My problem is that I cannot work out the formula to set on the OnInitReport() section to set this date criterion....

Any help is greatly appreciated!!!!!

Aaran

Comments

  • zarrynzarryn Member Posts: 29
    Perhaps this might work...
    PurchLine.Setfilter("Expected Receipt Date",'..%1',Calcdate('-3D',WORKDATE));
    
    Zarryn
  • andreofandreof Member Posts: 133
    Just use:

    date - 3

    and you will get the date you wanted


    Example: MESSAGE(FORMAT(161178D-3));

    and you'll get 13-11-78


    André
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • aaranaaran Member Posts: 10
    Andre,

    How would I combine your statement with todays date (rather than hard-coding a date in!)????
  • andreofandreof Member Posts: 133
    Depending if you want the system date or the application working date use:


    TODAY - 3

    or

    WORKDATE - 3

    Example:

    SETFILTER(Date Field,'..%1',TODAY - 3);


    André
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • aaranaaran Member Posts: 10
    It's not working....here's how I'm using the statement....what am I doing wrong?

    Report - OnInitReport()
    ExpDate:=(WORKDATE-2)
  • andreofandreof Member Posts: 133
    what is no working?
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • aaranaaran Member Posts: 10
    The report compiles and runs ok, but the dates on the lines returned on it are for 2nd/3rd/9th September etc. I'm expecting 31st Aug and before!
  • andreofandreof Member Posts: 133
    well, assuming it's a simple report, you just have to put the following code
    in the OnPreDataItem trigger:

    Setfilter("Expected Receipt Date",'..%1',WORKDATE-2);
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • naveenjainnaveenjain Member Posts: 7
    Yes, Keep in mind that you are writing this code in the OnPreDataItem NOT OnInitDataItem :!:
Sign In or Register to comment.