Defining the length of an answer

Is there any validation condition to define the number of digits for an numeric or text question? For example, for the question “What is the year of establishment?” I want the interviewer to answer with 4 numerical digits (eg: 1998) and not two (eg:98).
Thanks in advance, S

Dear Susana,

We have pattern for this. You can read about it in the article

Best regards,

Aleksandra Komarovska

Survey Solutions Team Support

For numeric question you can use validation conditions. For example, q1>1900 && q1<2017, or, using Survey Solutions functions: q1.InRange(1900,2017)


you have received two recommendations above. Note the important difference:

  1. in Aleksandra’s approach the interviewer’s will NOT be able to enter 2 digit values. Only 4 digits, or no value at all. But the 4 digits can still be e.g. 2222.
  2. in Michael’s approach the interviewer WILL be able to enter a value of just two digits, but this will be detected and an error message shown to the interviewer. The range however will also handle invalid 4-digit dates.

You can decide what is more important for you, or better yet, use a combination of the two approaches:
– enter the value as patterned string;
– create a (long) variable q1n=Long.Parse(q1.Value)
– add validation to q1 that q1n.InRange(1900,2017) with the error message “Year of establishment out of range”.

Note also that InRange(1900,2017) evaluates to TRUE for the values 1900 and 2017.

Please investigate these strategies, and close the case by indicating which was finally chosen.

Best, Sergiy Radyakin

Thank you all for the recommendations.
We consider In.Range option the best for the question.