Welcome to the LimeSurvey Community Forum

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

Prefilling default answers based on tokens for various types of question

  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #191375 by krosser
Hey guys!

I know that the 'Multiple short text' question allows to prefill the text fields, using the token attributes. But I would like to prefill answers for other types of questions: Radio(List), Multiple choice, Arrays...
Any advice on how to do that would be much appreciated.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191382 by tpartner
You can use the Expression Manager assignment operator in equation questions to set other questions - manual.limesurvey.org/Expression_Manager..._assignment_operator

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: krosser
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191383 by DenisChenu
manual.limesurvey.org/Expression_Manager..._Assignment_Operator

For example : Q00 : a single choice question, prefilled by a code in attribute 2

create a hidden equation question ate start of survey with
{Q00=if(is_empty(Q00.NAOK),TOKEN:ATTRIBUTE_2,Q00.NAOK)}


Else : bugs.limesurvey.org/view.php?id=14754 4.0 project

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: krosser
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago - 4 years 4 months ago #191393 by krosser
Great! Thanks guys.
So, I have to place a hidden equation question before the question to be prefilled.
I have tested it with a radio(list) and dropdown menu, and it works. But what to do with the multiple-choice question type?
I have found Tony's previous post from 3 years ago, but following the steps described there did not work for me.
www.limesurvey.org/de/foren/design-issue...n-information#136237

Is that method still relevant today or something has changed?

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Last edit: 4 years 4 months ago by krosser.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191398 by DenisChenu
Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1

{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}

and equG1 just have 1 …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: krosser
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago - 4 years 4 months ago #191405 by krosser

DenisChenu wrote: Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1

{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}

and equG1 just have 1 …


Thanks, but does it mean that I need to create an attribute for each answer choice/subquestion in that multiple-choice?
Also, the problem is that this method keeps prefilling that answer choice even after I deselect it, move to next page, and then come back to it - it is refilled again.
My intention is to give the respondent the ability to change his/her previous answer in that multiple choice and save a new value.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Last edit: 4 years 4 months ago by krosser.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191408 by DenisChenu

krosser wrote: Thanks, but does it mean that I need to create an attribute for each answer choice/subquestion in that multiple-choice?

You need a have a way to know if ech option must be checked or not.

krosser wrote: Also, the problem is that this method keeps prefilling that answer choice even after I deselect it, move to next page, and then come back to it - it is refilled again.

Did you read ?
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group

krosser wrote: My intention is to give the respondent the ability to change his/her previous answer in that multiple choice and save a new value.

Then : use token + prefill value for each token using VV import : it's the method i always use …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: krosser
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #191413 by krosser

You need a have a way to know if ech option must be checked or not.

Okay, understood.

Did you read ?
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group

Yes, but thought that everything was included in the code line. Can you please give an example of the part with reset to empty?

Then : use token + prefill value for each token using VV import : it's the method i always use …

Okay, I thought that token attributes would be a better way, especially when it is written in the instructions to VV that there might be errors with importing CSV back to LimeSurvey.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191435 by DenisChenu

krosser wrote:

You need a have a way to know if ech option must be checked or not.

Okay, understood.

Did you read ?
«Multiple choice : Y or empty, need an extra part to disable reset to empty. For example : another eqution question in the groupe , equG1» equG1 is here to know if user get to the group

Yes, but thought that everything was included in the code line. Can you please give an example of the part with reset to empty?

support.sondages.pro/?lang=en_US

krosser wrote:

Then : use token + prefill value for each token using VV import : it's the method i always use …

Okay, I thought that token attributes would be a better way, especially when it is written in the instructions to VV that there might be errors with importing CSV back to LimeSurvey.

I always use LibreOffice calc for vv edition : never have issue  …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • krosser
  • krosser's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #191440 by krosser

DenisChenu wrote: support.sondages.pro/?lang=en_US

Not really helpful.

DenisChenu wrote: I always use LibreOffice calc for vv edition : never have issue  …

Yeah, I use it too for CSVs. Will see how this works for complex questions.
It is just token attributes seemed easier and quicker because you do not need to analyse the structure of the exported CSV and map your question answers to codes used there. It is a lot of manual work, or writing additional scripts in R for prepopulating the CSV. You do not always have that time...

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191448 by DenisChenu

krosser wrote: Not really helpful.

really helpful if you open a ticket :)

Can you please give an example of the part with reset to empty?

There are NO reset to empty : all is included in
Code:
{Q00_sq01=if(is_empty(equG1.NAOK),if(TOKEN:ATTRIBUTE_2,"Y",""),Q00_sq01.NAOK)}
In the 1st equation (don't care about title)

Andf about 2nd equation

equG1 just have 1


If you can not do with this instruction : open a professional support ticket.

krosser wrote: Yeah, I use it too for CSVs. Will see how this works for complex questions.
It is just token attributes seemed easier and quicker because you do not need to analyse the structure of the exported CSV and map your question answers to codes used there. It is a lot of manual work, or writing additional scripts in R for prepopulating the CSV. You do not always have that time...

If you have 5 ro 10 question to prefill : really easy to do

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose