- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Filling question with random text from texts sample
- chfsantos
- Topic Author
- Offline
- New Member
Less
More
2 months 2 weeks ago #255964
by chfsantos
Filling question with random text from texts sample was created by chfsantos
Please help us help you and fill where relevant:
Your LimeSurvey version: online version
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template:
==================
hello from Brasil!
I am planning to make a survey where I will show on each question a different text randomly chosen from a saved sample of “n” texts. I will ask respondents about their perceptions about the text.
is this possible with Limesurvey? How?
thanks a lot
Your LimeSurvey version: online version
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template:
==================
hello from Brasil!
I am planning to make a survey where I will show on each question a different text randomly chosen from a saved sample of “n” texts. I will ask respondents about their perceptions about the text.
is this possible with Limesurvey? How?
thanks a lot
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
2 months 2 weeks ago #255968
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Filling question with random text from texts sample
If you have a small number of text strings, you can use ExpressionScript to generate a random number and display the corresponding text string.
Otherwise, you may need to use JavaScript to import a CSV file.
Searching the forum (or Google) should yield many examples.
Otherwise, you may need to use JavaScript to import a CSV file.
Searching the forum (or Google) should yield many examples.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 2 weeks ago #255969
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Filling question with random text from texts sample
How much is "n"?
And how many questions do you want to ask?
And how many questions do you want to ask?
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- chfsantos
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
2 months 2 weeks ago #255971
by chfsantos
Replied by chfsantos on topic Filling question with random text from texts sample
Good question!
I am working with "access of information" requests, so, N will me around 100, and each request (single text) can vary from 10 to 1000 words. So, texts are more likely to be long than short texts.
Thanks a lot
I am working with "access of information" requests, so, N will me around 100, and each request (single text) can vary from 10 to 1000 words. So, texts are more likely to be long than short texts.
Thanks a lot
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
2 months 2 weeks ago #255981
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Filling question with random text from texts sample
Hi, an easy way without javascript would be to store the texts as default answer into a question of type "huge text" (QText)
Maybe with this beginning
#00100021This is my first text#00200040And this is my second text, a bit longer#003....
Meaning: three characters to define the text number and five characters to define the length of this text.
Now you create your random numbers (rn) and find your text with these three equations
eqStart: {strpos(QText,'#'+rn)}
eqLength: {substr(QText,eqStart+4,5)}
eqText: {substr(QText,eqStart+9,eqLength)}
One obstacle:
The "text" type only allows up to 65000 characters.
So if your texts are longer in total you have to use two or even more of them.
Best you provide a lss export that shows your scenario.
Joffm
Maybe with this beginning
#00100021This is my first text#00200040And this is my second text, a bit longer#003....
Meaning: three characters to define the text number and five characters to define the length of this text.
Now you create your random numbers (rn) and find your text with these three equations
eqStart: {strpos(QText,'#'+rn)}
eqLength: {substr(QText,eqStart+4,5)}
eqText: {substr(QText,eqStart+9,eqLength)}
One obstacle:
The "text" type only allows up to 65000 characters.
So if your texts are longer in total you have to use two or even more of them.
Best you provide a lss export that shows your scenario.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.