Calculate Business Days w/ a Negative Integer

Calculate Business Days w/ a Negative Integer

Comments

  • Hello Decisioneers,

    For my situation, Ive a negative value integer trying to calculate a business prior to a set date. So for example, say the day Im looking for is August 9th and the assignment is due 3 business days before then. How can I go about this in a flow? Not sure if Decisions has any business day specific steps. Thank you in advance!

  • Hi jmcmann49,

    I’ve attached an example sub-flow which takes into account any weekends and holidays you’ve specified for a location. Ive detailed how this flow functions below.

    [color=rgb(0, 0, 0)]The inputs for this subflow are:[/color]
    [color=rgb(0, 0, 0)]
    [/color]
    [color=rgb(0, 0, 0)]DaysInPast- [/color][color=rgb(0, 0, 0)]an integer of days going back[/color][color=rgb(0, 0, 0)]
    [/color][color=rgb(0, 0, 0)]DateToCheck- [/color][color=rgb(0, 0, 0)]the starting date for this calculation[/color][color=rgb(0, 0, 0)]
    [/color][color=rgb(0, 0, 0)]LocationName- [/color][color=rgb(0, 0, 0)]Indicates Location which indicates holidays (System > System Data > Locations)[/color]

    [color=rgb(0, 0, 0)]Flow Overview:[/color]
    [color=rgb(0, 0, 0)]First, there is a rule which makes sure the value is not below 0 or negative. Then we have a subtract step to account for the additional day that’s in the Get Business Days Between Dates For Location step. [/color]

    [color=rgb(0, 0, 0)]The multiplication step is simply to transform our duration value into a negative (Duration*-1). The Find Guessed Start Date step takes the StartDate and subtracts the Duration giving us the date/reference point for the last steps.[/color]

    [color=rgb(0, 0, 0)]Finally, Get Business Days step goes into a rule which continues to calculate busi[/color][color=rgb(0, 0, 0)]ness days between two dates until the business days are equal to the duration from the input. Once they are equal, you’ll have the output date and number of business days from the indicated start date.[/color]
    [i]edited by Scott@decisions.com on 10/1/2019[/i]

Sign In or Register to comment.