1 Reply Latest reply on Jan 9, 2015 1:59 PM by jbante

    Calculate Business Days

    lizdell

      Title

      Calculate Business Days

      Your post

      I need to submit a document (Date FN Sent) then wait 15 business days excluding Statutory Holidays before proceeding with project.

      I am not a programmer and have learnt FM on my own so need some detailed instructions on how to do this.

      Thanks in advance for your help.

      Liz

        • 1. Re: Calculate Business Days
          jbante

          I wrote the BusinessDays custom function to help with these sorts of things. (It's dependent on the BusinessHolidays function, which you may need to edit for the holidays your application needs to observe.) The BusinessDays function calculates the number of business days between 2 dates. Whether or not that's exactly what you need depends on how you want your application to work.

          If your workflow starts with you looking at a particular a document (or project), and you just want to know if it's been 15 business days, then BusinessDays ( Document::dateSent ; Get ( CurrentDate ) ) ≥ 15 will return True (1) if it's 15 days old or older.

          If you want to do a find for all documents (or projects) submitted 15 or more days ago, you start with the current date and how many days ago you need (15) — you don't have the start date, which is what you need to create the right find request. You can reverse engineer the BusinessDays function to get the calculation you need, or you can just test dates in a loop going backwards until BusinessDays ( $testDate ; Get ( CurrentDate ) ) = 15, then build your find request using Set Field [Document::dateSent; "≤" & $testDate].