Welcome to the LimeSurvey Community Forum

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

Changing text of a Multiple Choice Question Type by an external resource file

  • achecchini
  • achecchini's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #230804 by achecchini
Hi,
Hi you are absolutely right and I apologize for my naivety.
Here the .lss file
The desired is to be able to write an additional record on the DB that "decodes" the string (for example the first choice):

{trim(if(week==1,substr(QDef_1,0,46),if(week==2,substr(QDef_2,0,46),if(week==3,substr(QDef_3,0,46),if(week==4,substr(QDef_4,0,46),if(week==5,substr(QDef_5,0,46),if(week==6,substr(QDef_6,0,46),if(week==7,substr(QDef_7,0,46),if(week==8,substr(QDef_8,0,46),if(week==9,substr(QDef_9,0,46),if(week==10,substr(QDef_10,0,46),if(week==11,substr(QDef_11,0,46),if(week==12,substr(QDef_12,0,46),if(week==13,substr(QDef_13,0,46),if(week==14,substr(QDef_14,0,46),if(week==15,substr(QDef_15,0,46),if(week==16,substr(QDef_16,0,46),if(week==17,substr(QDef_17,0,46),if(week==18,substr(QDef_18,0,46),if(week==19,substr(QDef_19,0,46),""))))))))))))))))))))}

with the match to which it refers:

Milan-Udinese sabato 13/08 18:30

Thank you in advance for any help you will want to give

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #230829 by Joffm
Which version of LimeSurvey are you using?

Seems to be stone age. In your lss I saw a database version 177.

To answer your question:
1. Remove the ,"" from your IF-statement in the answer options. No idea why.
2. Create a question of type "short text" (hidden) and enter in the default answer {Q2.shown}


  

  


Joffm

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

Please Log in to join the conversation.

  • achecchini
  • achecchini's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #230836 by achecchini
Hi Joffm, thanks for the replay. 

version MUST be 2.05, and yes it's a jurassic time ...

If I try to eliminate ,"" from IF statement in the answer option I get an error (see attachment).

And If I use the statement with ,"" result of L3 hidden short test question was BLANK.

I'm really confused by this beavior ...

Ago

 
Attachments:

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #230838 by Joffm
You did not remove the comma!

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

Please Log in to join the conversation.

  • achecchini
  • achecchini's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #230855 by achecchini
I try but with the same result. See attachment (first line).

I'm really confused ...

Have a nice day
Attachments:

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #230856 by Joffm
You see, there is still this last comma before the "))))))))...".
Remove it

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

Please Log in to join the conversation.

  • achecchini
  • achecchini's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #230857 by achecchini
If I put a value at the end of the expression it seem functioning:
,if(week==19,substr(QDef_19,0,46),0))))))))))))))))))))}
didn't understand why but I'm pragmatic ...
 

Please Log in to join the conversation.

  • achecchini
  • achecchini's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #230858 by achecchini
I declared victory too soon !!! If I hide the question records was saved blank !!!

I breakdown!! :-(

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago - 2 years 7 months ago #230859 by Joffm
Hi, 
I never tested in your stone age version.
Somewhere I have a 2.06.
Let's see.
And I missed that in this version it probably was not allowed to omit the FALSE part in an IF.

On the other side: What for do you want to have this text? It's only a bit more comfortable.
But in your export of the data you have everything you need:
The week and the code of the selected answer.
 

You should use better codes than "SQ001", "SQ002" (which seem to be relicts from your initial "multiple" question here) like 1,2,3,4,... 

Okay, tested in 2.06.
 

Everything works fine,too. Except that you can't hide the question be "Always hide this question."
So, either hide it by javascript.
Or show it as a kind of confirmation with a text like "You selected abc"
 

File Attachment:

File Name: limesurvey...3845.lss
File Size:45 KB

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 7 months ago by Joffm.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose