Checking the type of duration that was selected by the user

One of our users recently asked whether it was possible to show different follow-up questions, depending on the type of duration that was selected by the end-user.

For example, if the end-user would answer question X with a certain number of “weeks”, then follow-up question Y would need to be shown (asking for the weekday), while if a number of months was shown, then a different follow-up question Z must be shown.

The answer is to use the newly added function @duration-unit, which takes a duration as input, and returns either ‘year’, ‘month’, ‘day’, ‘week’ or ‘quarter’. For example, @duration-unit(23 years) returns “year”.

You can then combine this special function with an expression condition inside the Q&A:

a) Assign the duration-question an identifier (“xxx” in my case)

image

b) Set an expression condition to the follow-up question

image