Validation: Date 2 > Date 1

Difficulty level: Difficult

What does the functionality do?

You can use this function, if you ask a participant in a survey to enter two dates in two different questions, where the date in the second question (e.g. question with variable screen code q2) must be after the date in the first question (e.g. question with variable screen code q1).

Use case and how to set it up?

In order to set up this function, proceed as follows:

  • Include the Date question type for the first date in your survey, formulate the question and provide hint text, if appropriate (e.g. DD/MM/YYYYY). The response data type is: Date.
  • Repeat the above-mentioned step for the second date.
  • Subsequently, add the Validation question type to the survey. The validation element can be added below the two date questions.
  • Specify the error message a participant will see, when he/she enters a date in the second date question that precedes the date in the first question.
  • Click the Edit conditions button to launch the Filter window which allows you to record the following data:
    • Hide this validation message
    • if – Calculation – date2number(q2) – > (greater than) – date2number(q1)
  • Click the green Save changes button.

Note: The calculation in the filter tests whether the date entered by a participant in the question with screen code q2 is LATER than the date selected by him/her in the question with screen code q1.

See also: Value Assignment Functions

Updated on November 16, 2022
Was this article helpful?

Related Articles

Need Support?
Please login to your Survalyzer account and use the "Create Support Request" form.
Login to Survalyzer