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
  • chfsantos's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago #255964 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

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #255968 by tpartner
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.

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
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #255969 by Joffm
How much is "n"?
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
  • chfsantos's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago #255971 by chfsantos
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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #255981 by Joffm
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
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose