Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

End a survey when displaying text

  • Chiripa
  • Chiripa's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207206 by Chiripa
End a survey when displaying text was created by Chiripa
I have a survey with 2 questions:

List radio (L) and Date / time (D)

List radio (L) Date / time (D)
Option 1 10/20/2000
Option 2 10/20/2002
Option 3 10/20/2004
Option 4 10/20/2006

The user selects one of the options and then a date. Each option has a specific date. If the date is less, a message appears and the survey must end. If the date is the same or higher, the survey continues.

The message is shown in a "show text (X)" which does not allow to use quotas.

How can it be done?

I attach an example for which the message appears when Preschool is selected and the date 2013-3-31 or if First is selected and the date 2012-3-31

Thank you
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago - 3 years 5 months ago #207290 by Joffm
Replied by Joffm on topic End a survey when displaying text
No, either you display the text in the screen out message
or you may use two equations.

1. an equation that decides if the text is displayed or not
2. an equation (the same formula) which you use to screen out.

But in my opinion the screen out message of the quota is sufficient.
With a little bit of css




Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 5 months ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207299 by Joffm
Replied by Joffm on topic End a survey when displaying text
And I saw in your example that it is still something old without numerical codes for grade
and without the equation I showed you in the Spanish part of the forum.

Therefore forget my previous answer here. I does not apply because you do not use equations.

In my opinion the solution I showed in the Spanish part is not so difficult to understand.

{date('Y-m-d',mktime(0,0,0,3,31,2014-Q00007)) le Q00025}

First we calculate the year.
For Preschool (coded 1 in Q00007) it is 2014-1 = 2013
For 1st grade (coded 2 in Q00007) it is 2014-2 = 2012
For 2nd grade (coded 3 in Q00007) it is 2014-3 = 2011
...

{date('Y-m-d',mktime(0,0,0,3,31,2014-Q00007)) leQ00025}
Next we build a UNIX timestamp with the funktion mktime.
mktime takes the parameters mktime(hour, minute, second, month, day, year)

{date('Y-m-d',mktime(0,0,0,3,31,2014-Q00007)) le Q00025}
At last we convert this timestamp into a date with format "YYYY-MM-DD".

So for Preschool we get "2013-03-31"
For 1st grade we get "2012-03-31"
For 2nd grade we get "2011-03-31"
...

And this is compared to the entered date of birth (Q00025) which has the same format
If this calculated date is less or equal than the date of birth everything is fine, the pupil is younger, else he is too old.

So we can create an equation like

{if(date('Y-m-d',mktime(0,0,0,3,31,2014-Q00007)) le Q00025,1,0)}

This equation we use to screen out the ones who are to old, where the equation is equal to "0".

And if you want to display a message before the screen out use the relevance equation of this text display
date('Y-m-d',mktime(0,0,0,3,31,2014-Q00007)) gt Q00025
So it is displayed when the calculated date is not less or equal the date of birth, but greater (gt)

And after the text display you enter the equation to screen out.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose