Welcome, Guest
Username: Password: Remember me

TOPIC: Setting quota for age in LS?

Setting quota for age in LS? 2 years 4 months ago #70944

  • ls_greg
  • ls_greg's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 15
  • Karma: 0
Hello,

I'm running a survey, and need to make sure I get a broad cross section of people (so I can generalize my conclusions to the general population, and not just uni students)

So I'm setting a quota for ages.

I originally had the participants enter their birth year, but changed this to a drop down list of possible birth years to allow quotas.

But it looks like I will have to create a separate rule for each possible birth year - this is tedious, boring, and will eat up a lot of time. Is there a more efficient way to set a quota?
The administrator has disabled public write access.

Re: Setting quota for age in LS? 2 years 4 months ago #70947

  • ls_greg
  • ls_greg's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 15
  • Karma: 0
Would it be possible to have a "hidden" checkbox question, then add some javascript that automatically checks the checkbox if the age is below a certain limit?

If so, does anyone have some sample code I could use?
The administrator has disabled public write access.

Aw: Setting quota for age in LS? 2 years 4 months ago #70952

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

perhaps you can export the whole survey as .lss file, edit this file (the structure is xml so you can use a text or xml editor to edit the file) and reupload it. If you open the .lss file you'll find something like
<quota>
  <fields>
   <fieldname>id</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>name</fieldname>
   <fieldname>qlimit</fieldname>
   <fieldname>action</fieldname>
   <fieldname>active</fieldname>
   <fieldname>autoload_url</fieldname>
  </fields>
  <rows>
   <row>
    <id><![CDATA[1]]></id>
    <sid><![CDATA[86751]]></sid>
    <name><![CDATA[Age restriction 1]]></name>
    <qlimit><![CDATA[50]]></qlimit>
    <action><![CDATA[1]]></action>
    <active><![CDATA[1]]></active>
    <autoload_url><![CDATA[0]]></autoload_url>
   </row>
   <row>
    <id><![CDATA[2]]></id>
    <sid><![CDATA[86751]]></sid>
    <name><![CDATA[Age restriction 2]]></name>
    <qlimit><![CDATA[50]]></qlimit>
    <action><![CDATA[1]]></action>
    <active><![CDATA[1]]></active>
    <autoload_url><![CDATA[0]]></autoload_url>
   </row>
   <row>
    <id><![CDATA[3]]></id>
    <sid><![CDATA[86751]]></sid>
    <name><![CDATA[Age restriction 3]]></name>
    <qlimit><![CDATA[50]]></qlimit>
    <action><![CDATA[1]]></action>
    <active><![CDATA[1]]></active>
    <autoload_url><![CDATA[0]]></autoload_url>
   </row>
  </rows>
 </quota>
 <quota_members>
  <fields>
   <fieldname>id</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>qid</fieldname>
   <fieldname>quota_id</fieldname>
   <fieldname>code</fieldname>
  </fields>
  <rows>
   <row>
    <id><![CDATA[1]]></id>
    <sid><![CDATA[86751]]></sid>
    <qid><![CDATA[1]]></qid>
    <quota_id><![CDATA[1]]></quota_id>
    <code><![CDATA[1]]></code>
   </row>
   <row>
    <id><![CDATA[3]]></id>
    <sid><![CDATA[86751]]></sid>
    <qid><![CDATA[1]]></qid>
    <quota_id><![CDATA[4]]></quota_id>
    <code><![CDATA[9]]></code>
   </row>
  </rows>
 </quota_members>
 <quota_languagesettings>
  <fields>
   <fieldname>quotals_id</fieldname>
   <fieldname>quotals_quota_id</fieldname>
   <fieldname>quotals_language</fieldname>
   <fieldname>quotals_name</fieldname>
   <fieldname>quotals_message</fieldname>
   <fieldname>quotals_url</fieldname>
   <fieldname>quotals_urldescrip</fieldname>
  </fields>
  <rows>
   <row>
    <quotals_id><![CDATA[1]]></quotals_id>
    <quotals_quota_id><![CDATA[1]]></quotals_quota_id>
    <quotals_language><![CDATA[de]]></quotals_language>
    <quotals_name><![CDATA[Age restriction 1]]></quotals_name>
    <quotals_message><![CDATA[message]]></quotals_message>
    <quotals_url><![CDATA[]]></quotals_url>
    <quotals_urldescrip><![CDATA[]]></quotals_urldescrip>
   </row>
   <row>
    <quotals_id><![CDATA[2]]></quotals_id>
    <quotals_quota_id><![CDATA[2]]></quotals_quota_id>
    <quotals_language><![CDATA[de]]></quotals_language>
    <quotals_name><![CDATA[Age restriction 2]]></quotals_name>
    <quotals_message><![CDATA[message]]></quotals_message>
    <quotals_url><![CDATA[]]></quotals_url>
    <quotals_urldescrip><![CDATA[]]></quotals_urldescrip>
   </row>
   <row>
    <quotals_id><![CDATA[4]]></quotals_id>
    <quotals_quota_id><![CDATA[4]]></quotals_quota_id>
    <quotals_language><![CDATA[de]]></quotals_language>
    <quotals_name><![CDATA[Age restriction 3]]></quotals_name>
    <quotals_message><![CDATA[message]]></quotals_message>
    <quotals_url><![CDATA[]]></quotals_url>
    <quotals_urldescrip><![CDATA[]]></quotals_urldescrip>
   </row>
  </rows>
 </quota_languagesettings>

Perhaps it'll be a little faster than adding the rules manually.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Re: Setting quota for age in LS? 2 years 4 months ago #70962

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
A solution may be to have a numeric question for the age and then use JavaScript to click radios in a hidden question depending on the value entered in the numeric.

If you can attach a group with the numeric question and a radio question with your desired age ranges I'll give you a little script.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.179 seconds
Donation Image