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
5 replies
Subscribers
8 subscribers
Views
1712 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
HI- We are working on an application where a user reserves inventory for certain
rachealv537
over 10 years ago
HI- We are working on an application where a user reserves inventory for certain events. The events can be over multiple dates. So, the inventory has to be reserved for each day of the event.
Our form has a begin date and an end date. I would like to retrieve the actual dates between and including the beginning date and the end date. The next step is to reserve the inventory for all of these dates. I do not want the user to have to enter every date individually.
Is there a rule or function that already exists to accomplish this? If not, any advice on the best way to accomplish this? Thanks....
OriginalPostID-128100
OriginalPostID-128100
Discussion posts and replies are publicly visible
Parents
0
Robert Shankin
Appian Employee
over 10 years ago
Hi Racheal -
You can get your list of dates using the following pair of rules:
(rule 1)
rule!test_addDay(firstDay,daysToAdd)
inputs: firstDay, date; daysToAdd, Number (Integer)
definition:
=with(
ri!firstDay+ri!daysToAdd
)
(rule 2)
rule!test_getDatesInclusive(start, end)
inputs: start, date; end, date
definition:
=with(
local!end: ri!end+1,
local!termArray: enumerate(local!end-ri!start),
local!dateArray: repeat(length(termArray),ri!start),
apply(
rule!test_addDay,
merge(
local!dateArray,
local!termArray
)
)
)
usage:
rule!test_getDatesInclusive(11/1/2014, 11/5/2014)
returns:
test_getDatesInclusive: 11/1/2014, 11/2/2014, 11/3/2014, 11/4/2014, 11/5/2014
I hope that helps.
Thanks,
Rob
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Robert Shankin
Appian Employee
over 10 years ago
Hi Racheal -
You can get your list of dates using the following pair of rules:
(rule 1)
rule!test_addDay(firstDay,daysToAdd)
inputs: firstDay, date; daysToAdd, Number (Integer)
definition:
=with(
ri!firstDay+ri!daysToAdd
)
(rule 2)
rule!test_getDatesInclusive(start, end)
inputs: start, date; end, date
definition:
=with(
local!end: ri!end+1,
local!termArray: enumerate(local!end-ri!start),
local!dateArray: repeat(length(termArray),ri!start),
apply(
rule!test_addDay,
merge(
local!dateArray,
local!termArray
)
)
)
usage:
rule!test_getDatesInclusive(11/1/2014, 11/5/2014)
returns:
test_getDatesInclusive: 11/1/2014, 11/2/2014, 11/3/2014, 11/4/2014, 11/5/2014
I hope that helps.
Thanks,
Rob
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data