In some scenarios we need a flexible number of selections, such that we can’t know beforehand. for example: multiple dates range, where the user may add or remove time periods. One way to achieve this is to have a number of fields on a Form View, showing the controls of the relevant ones and hiding the others:
The user presses + on the last visible line to add another row, and – to remove the last visible one.
Modeling the scenario:
2. Add a Data Share element. In the Define Data dialog add a numeric field called time_selections and set its default value to 1. This field stands for the number of selection rows:
3. The mapping between the Form View and the Data Service looks like this (notice the number of time selections coming from the Data Share):
4. Move to the layout board and arrange the From / To controls in different columns (right click => Insert Column to add a column to the Form View).
5. Add another column for the + / – buttons. Where more than one button is required add a Melting Box control and add the buttons to it.
6. Set visibility conditions for the Date Picker controls according to the row, depending on the time_selections variable. example 1:
7. Set visibility condition for the buttons. In this example we want them visible on the last visible row only. example 1:
8. Define the Add / Remove row Actions for the control. We need to increment / decrement the value of the time_selections variable. Example 1: