HomeGuidesRecipesAPI
HomeGuidesAPILog In

Validating dates between rows in a repeating section

With Infiniti, you can easily gather complex information chronologically. This handy feature could be applied to create travel itineraries, leave requests, to create schedules, employment or residence history forms - just to name a few possibilities.

350350

It’s achieved by creating a repeating section where each section contains a start and end date question, together with any other questions relevant to your business process. When the user adds additional questions Infiniti will automatically calculate the defaults and ensure the specified dates are in order and if necessary ensure that there are no gaps.

It’s simple - just reference a question in the previous row of a repeater.

Here’s an example

Here is a basic project where we use the [previous] function to calculate and validate values based other rows in a repeating section.

450450

The label ‘Segment Start’ has the following formula.

321321

This checks to see if the current row is the first row or not. If it is the first row the label’s value could be today’s date or another date relevant to your process. In the above example, an overall start date was specified on the previous page. For subsequent rows, the label will resolve to its previous row’s Segment End + 1 Day question.

Below is the formula in Segment End + 1 day. The formula takes the date for Segment End and adds an additional day. This is done to ensure that there are no overlapping days when it comes to validation.

350350

Be sure to add any possible validations to all your date questions to help your user where you can. For example, ensure all days are in the future.

337337

Additionally, in the above example, we validate the last segment end to ensure it matches a value collected earlier in the form using the formula below. This variable will check to see if End Date is equal to the Segment End of the final row. If this is true it will return with a value of 1. If not it will return with a value of 0.

334334