calculate business days
Hi all I'm hoping you can help me... I'm looking for a way to calculate a due date based on two separate fields. Field one is the start date, and field two is the number of business days we have to compete the task. The resulting calculation should give the appropriate due date based on those two fields. Any thoughts on how this can be accomplished?

  • Hi Rainer! Thanks for sharing your script. I use the Version2 but have a little issue. Eg: Add 5 business days. Sometimes, it count the starting day (eg start date 1/01/2016 calc, end date = 05/01/2016) and sometimes, it add 5 days after (eg start date 01/01/2106 calc end date = 06/01/2016.) I'm am doing something wrong? Thanks
  • How would you go about calculating the difference in business days between two dates (@End - @Beginning)
  • Hello Alain, in Globiflow you should create 2 flows in the app where you want to calculate the due date. Flow1: Trigger: when a new item is created Action: Update this item in field [DueDate] = calc date ("Y-m-d", strtotime( [field-token calc dueDate ))."00:00:00" Flow 2: Trigger. When an item is update Action: same as flow 1. Depending on your individual workflow you can set filters (e.g. for flow 2: If [number of business days] hast just changed - or: if [startDate] hast just changed - you can't set such a filter on calculation fields, cause changes there didn't fire a flow).
  • Hi Rahil, I have the same problem... A Question to Rainer: How dos the transfer with Globiflow work? I just signed up with Globiflow, but I can't see how i can "creat" this transfer. Can you tell me how this works? Thanks Alain
  • No, you'll get the calculated date as a text string and you can't change this calculation field from text to date. If you use the Podio extension Globiflow you can transfer automatically the result from this calculation field into a date field. For that you have to create a Podio date field "Due date" in your app, rename the calculation field where you calculate the due date to "Calc Due Date" and put it to the end of the template as a "help field", then transfer with Globiflow the result into the real date field (that can be shown in a calendar).
  • hi @Rainer -- Thank you for your quick help and response! Quick question... would the calculated field be a date field automatically, or do I need to set it as such?
  • Hello Rahil, try something like this: Version 1 adds only the # of days, regradless weekends: N = [number of business days] S = [StartDate] moment(S).add(N, "days").format('DD.MM.YYYY') Version 2 adds business days only: N = [number of business days] S = [StartDate] function addWeekdays(date, days) { date = moment(S); while (days > 1) { date = date.add(1, 'days'); if (date.isoWeekday() !== 6 && date.isoWeekday() !== 7) { days -= 1; } } return date; } var date = addWeekdays(moment(),N); moment(date).format("DD.MM.YYYY | dddd ") The formatterm you can change like you want. The terms in [...] need to be replaced with your field names that you have in your app. without square brackets Cheers, Rainer
This question is closed.