Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
7 subscribers
Views
1948 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I am trying to use the caladddays() function, but I keep getting this error:
jamelj
over 10 years ago
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
0
gauravg568
over 10 years ago
A workaround perhaps is to rewrite the expression as: =caladddays(caladddays(today(),262),1). If the number of days to add is a variable, in theory, you could create an expression that iterates and adds number of days in a year at a time until all days have been added.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
silambarasanr
A Score Level 1
over 10 years ago
Hi jamel,
1.Please make sure that the first parameter should be of type Date and time. Try now() instead of today().
2.For second parameter please refer notes in the below link
forum.appian.com/.../Date_and_Time_Functions
Hope this helps!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Michael Tan
Appian Employee
over 10 years ago
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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jamelj
over 10 years ago
Thank you, both parameters are variables, so i will adjust the rule to repeat.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel