HI- We are working on an application where a user reserves inventory for certain

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
    Certified Lead Developer
    Hi - I created an expression rule to add days to your start date.

    rule!startDatePlusDay" =ri!startdate+ri!day

    then a second expression to iterate over the first one for the number of days needed.

    rule!createDateArray =apply(rule!startDatePlusDay,enumerate(tointeger(ri!enddate-ri!startdate)+1),ri!startdate)

    with input start of "11/42014" and end date of "11/10/2014" the output is:

    {11/4/2014, 11/5/2014, 11/6/2014, 11/7/2014, 11/8/2014, 11/9/2014, 11/10/2014}

    Hope that helps!
Reply
  • 0
    Certified Lead Developer
    Hi - I created an expression rule to add days to your start date.

    rule!startDatePlusDay" =ri!startdate+ri!day

    then a second expression to iterate over the first one for the number of days needed.

    rule!createDateArray =apply(rule!startDatePlusDay,enumerate(tointeger(ri!enddate-ri!startdate)+1),ri!startdate)

    with input start of "11/42014" and end date of "11/10/2014" the output is:

    {11/4/2014, 11/5/2014, 11/6/2014, 11/7/2014, 11/8/2014, 11/9/2014, 11/10/2014}

    Hope that helps!
Children
No Data