I am trying to use the caladddays() function, but I keep getting this error:

I am trying to use the caladddays() function, but I keep getting this error:

"Expression evaluation error at function 'caladddays': Cannot add more than a year's worth of days."

Is there a way to be able to add more that a year's worth of work days to a date? For example, how can I perfrom the following function:

caladddays(today(),263)
...

OriginalPostID-102385

OriginalPostID-102385

  Discussion posts and replies are publicly visible

Parents
  • Here is a rule you can use which uses the iterative approach mentioned earlier:

    if(ri!daysToAdd<=262,caladddays(today(),ri!daysToAdd),reduce(fn!caladddays,merge({today()},{0}),{repeat(quotient(ri!daysToAdd,262),262),mod(ri!daysToAdd,262)}))

    This uses the looping function reduce to call the caladddays function as many times as required. If you pass in 787, this is divisible by 262 three times. 262 is then repeated in our array three times. The last portion will be any additional days which yield a remainder. This is returned using the mod function, so the last value will be the remaining days or 0.

    The first half of the if statement is for the simple scenario when you are passing in 262 or less days.
Reply
  • Here is a rule you can use which uses the iterative approach mentioned earlier:

    if(ri!daysToAdd<=262,caladddays(today(),ri!daysToAdd),reduce(fn!caladddays,merge({today()},{0}),{repeat(quotient(ri!daysToAdd,262),262),mod(ri!daysToAdd,262)}))

    This uses the looping function reduce to call the caladddays function as many times as required. If you pass in 787, this is divisible by 262 three times. 262 is then repeated in our array three times. The last portion will be any additional days which yield a remainder. This is returned using the mod function, so the last value will be the remaining days or 0.

    The first half of the if statement is for the simple scenario when you are passing in 262 or less days.
Children
No Data