Results 1 to 4 of 4
  1. #1
    Join Date
    May 2008
    Posts
    14

    Exclamation Unanswered: CurrentDate -1 but exclude sat and sun

    Hi
    I have a formula that looks at the date before and colates all the data for that date. Unfortunatley whan we run the report on a monday morning it looks at sundays data which there is none as we finish on a friday.

    how can I amend my code so that when we run the report on a monday it does not include saturday or sunday?

    Code:
    IF {Sales_Order_Detail_File.DateInvoiceJulian} in  CurrentDate-1 to CurrentDate 
    
    THEN
    {Sales_Order_Detail_File.UnitsTransactionQty}
    ELSE 0
    Thanks in advance

    Darren

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Just to confirm; when you run it on a Sunday or Monday you want Friday data, right?

    Here's some psedu(ish) code
    Code:
    days_variable = integer
    
    days_variable = 
      CASE DateDiff(days, 0, CurrentDate) MODULUS 7
        WHEN 0 THEN -3 //Monday?
        WHEN 6 THEN -2 //Sunday?
        ELSE -1
      END
    
    date_for_comparison = DateAdd(days, days_variable, CurrentDate)
    HTH, please ask questions if you don't understand
    George
    Home | Blog

  3. #3
    Join Date
    May 2008
    Posts
    14
    Many thanks for you reply but not sure where to insert this in to my existing code. I would appreciate any guidence

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Before we delve much further with this - why can't you just set up a prompt on the report for the date? This would allow the users to run point in time reports!

    They could run off last Wednesdays report this morning if they wanted - would that be a better solution?
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •