- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Generate subquestions with participant attribute separated by comams
- Gonzalo12354
- Topic Author
- Offline
- New Member
Less
More
2 weeks 2 days ago #262976
by Gonzalo12354
Generate subquestions with participant attribute separated by comams was created by Gonzalo12354
Hello, I am having problems because I want to generate subquestions in a multiple choice question separated by commas.
This is an example of the participant attribute value: "AF1, AQ3, AV9" I want to have 3 subquestions but I want the possibility if another participant has more values to add more subquestions.
Thank you very much.
This is an example of the participant attribute value: "AF1, AQ3, AV9" I want to have 3 subquestions but I want the possibility if another participant has more values to add more subquestions.
Thank you very much.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13053
- Thank you received: 4020
2 weeks 1 day ago #263116
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Generate subquestions with participant attribute separated by comams
Hi,
What I understand is:
There is a question of type "multiple" with subquestions coded "AF1", "AQ3", "AV9", and some more
Now one participant has an additional attribute "AF1, AQ3, AV9"; another participant may have "AF3, AP7, AV9, AR1, AB5"
And you want to show the resp. subquestions.
If this is correct, you do this with the function "strpos(haystack,needle)" as subquestion condition,
like
strpos(TOKEN:ATTRIBUTE_1,"AF1")>0
Make sure that the result of the function is not 0; 0 means "not found".
You can do this by adding some character at the start of the attribute, like "#AF1, AQ3, AV9"
Joffm
Why did you not only ignore the questions at the beginning, no, you removed them.
It is not a joke that we ask these questions.
What I understand is:
There is a question of type "multiple" with subquestions coded "AF1", "AQ3", "AV9", and some more
Now one participant has an additional attribute "AF1, AQ3, AV9"; another participant may have "AF3, AP7, AV9, AR1, AB5"
And you want to show the resp. subquestions.
If this is correct, you do this with the function "strpos(haystack,needle)" as subquestion condition,
like
strpos(TOKEN:ATTRIBUTE_1,"AF1")>0
Make sure that the result of the function is not 0; 0 means "not found".
You can do this by adding some character at the start of the attribute, like "#AF1, AQ3, AV9"
Joffm
Why did you not only ignore the questions at the beginning, no, you removed them.
It is not a joke that we ask these questions.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Gonzalo12354
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
2 weeks 1 day ago #263126
by Gonzalo12354
Replied by Gonzalo12354 on topic Generate subquestions with participant attribute separated by comams
Hello, thank you very much for the reply, what I meant was: I have a participant that in the attribute1 has codes separated by commas for example ABC1,DEF2,GHI3 and has no limit can have many or 1, so what I want is to generate subquestions where each option is a code, I don't care about the code of the sub-question and also the code of the participant., the thing is that I generate x subquestions for x values of the attribute that are separated by commas.
So the attribte_1:" ABC1,DEF2,GHI3"
Q1:Choose code:
sbq1: ABC1
sbq2: DEF2
sbq3: GHI3
I hope this is now better understood and thank you very much.
So the attribte_1:" ABC1,DEF2,GHI3"
Q1:Choose code:
sbq1: ABC1
sbq2: DEF2
sbq3: GHI3
I hope this is now better understood and thank you very much.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13053
- Thank you received: 4020
2 weeks 1 day ago #263129
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Generate subquestions with participant attribute separated by comams
So in the attribute there's not the code but the text of the subquestions
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Gonzalo12354
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
2 weeks 1 day ago - 2 weeks 1 day ago #263131
by Gonzalo12354
Replied by Gonzalo12354 on topic Generate subquestions with participant attribute separated by comams
Right in the attribute there can be codes or anything else, the important thing is that it is separated by commas and I want each sub-question to be generated for each comma, so to speak. So if the attribute_1 has: "apple, pear, watermelon" in the multiple option question I want to have 3 options 1 for each fruit.
Last edit: 2 weeks 1 day ago by Gonzalo12354. Reason: Missed word
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13053
- Thank you received: 4020
2 weeks 1 day ago #263144
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Generate subquestions with participant attribute separated by comams
Please, do not use the word "codes" for something that is neither a question code nor a subquestion code.
You still didn't answer the questions at the beginning about version, hosting, etc.
Have you rights to use javascript?
If not it will be difficult as there's no implemented function to split a text.
So you have to do this with some "equations".
On the other side it shouldn't be too difficult to split this list beforehand and save it in several attributes.
Joffm
You still didn't answer the questions at the beginning about version, hosting, etc.
Have you rights to use javascript?
If not it will be difficult as there's no implemented function to split a text.
So you have to do this with some "equations".
On the other side it shouldn't be too difficult to split this list beforehand and save it in several attributes.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Gonzalo12354
Please Log in to join the conversation.