Check out the LimeSurvey source code on GitHub!

Connect LimeSurvey with database (or any other form of text storage)

More
5 years 2 weeks ago #73375 by yannischris
That's great! I am completely new to LimeSurvey so I don't know what "custom variables" or the "token table" is. I suppose that "token table" is the table where the answers are stored but anyway I should check the manual for more ;-). Thanks for helping!

Please Log in to join the conversation.

More
5 years 2 weeks ago #73378 by Mazi
Answers data is stored at the lime_survey_12345 table which is created when you activate a survey.
The token table holds participant information and tokens which can be seen as one time passwords, see: docs.limesurvey.org/Tokens&structure=Eng...tions+for+LimeSurvey


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 weeks ago #73379 by yannischris
Oh I see! So the idea (according to the third approach) is to "over-use" the token table, in the sense that it will do something other than what it's supposed to. I.e. create custom variables in the token table and use them to pre-fill a portion of the answers in the survey, at the time that the survey is loaded. Is this so?
Btw I didn't find anything in the "Tokens" section regarding "custom variables". Should I look somewhere else in the manual?

Please Log in to join the conversation.

More
5 years 2 weeks ago #73382 by holch
Well, actually the custom variables have been created exactly for that: to pass information that is already avaible to the questionnaire and work with it (you can use filters based on it, etc).

So if you have a spreadsheet with the contacts and additional information per respondent, that you wouldn't need to ask again (or that you would like them to confirm) you can include this into the token table and this data can then be connected directly to the data from the questionnaire.

In the manual they are called "user-defined attribute fields" and can be found here:
docs.limesurvey.org/Tokens&structure=Eng...ned_attribute_fields

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 2 weeks ago #73383 by Mazi
At the token table you can store individual attribute data for each entry, see docs.limesurvey.org/Tokens&structure=Eng...ned_attribute_fields


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 weeks ago #73406 by Something
Hello!

Thank you for your answers!

Mazi wrote: The problem with the approach you are describing is that Limesurvey stores all answer data at the lime_survey_12345 (12345 = survey ID) table with an incrementing ID. You can't partly fill that table and let the user add the rest.


This is not exactly what I meant :-)
What I meant was to create and use a new table (not lime_survey_12345) in the LimeSurvey DB, which I will populate (somehow) with the data required to pre-fill some fields of the questionnaire. Let's call it prefil_12345. Then, when LimeSurvey would load the questionnaire to show it to the user, it would also load certain fields from the prefil_12345 table. When the user completes the survey, it would be eventually stored in the lime_survey_12345 table (along with the prefiled values).

holch wrote: Well, actually the custom variables have been created exactly for that: to pass information that is already avaible to the questionnaire and work with it (you can use filters based on it, etc).

So if you have a spreadsheet with the contacts and additional information per respondent, that you wouldn't need to ask again (or that you would like them to confirm) you can include this into the token table and this data can then be connected directly to the data from the questionnaire.


So this is great! It is exactly what I was thinking of, albeit the table is already there, and there is no need to create a new one in the DB :-)

Regarding populating the token table with external data, I could create a simple service that fetches the required data from an external file (e.g. txt or xml) or even another DB and put them in there, to be used then by LimeSurvey.

Please Log in to join the conversation.

More
5 years 2 weeks ago #73407 by yannischris
So you create these attribute fields (I suppose that you can create as many as you want), and then you use javascript to load them as pre-filled answers in certain survey questions, at loading time. Got it ;-)
And if I want to pre-fill an answer, but this time from the answers of another (answered) survey, rather than from the token table? Can I as well use javascript to load these answers from the lime_survey_12345 table?

Please Log in to join the conversation.

More
5 years 2 weeks ago #73408 by Something

yannischris wrote: So you create these attribute fields (I suppose that you can create as many as you want), and then you use javascript to load them as pre-filled answers in certain survey questions, at loading time. Got it ;-)
And if I want to pre-fill an answer, but this time from the answers of another (answered) survey, rather than from the token table? Can I as well use javascript to load these answers from the lime_survey_12345 table?

But why would you like to do this? You would have to choose one of the many answers to the same questionnaire to use as prefil values. Unless you only allow one user to fill the source questionnaire. Anyway, I guess it should be doable but in a less straightforward manner than just using the custom variables.

Please Log in to join the conversation.

More
5 years 2 weeks ago #73411 by yannischris
Yes that's what I had in mind! Imagine that there is a survey that is not user specific, from which I want to extract some pre-filled answers for the user specific ones.

Please Log in to join the conversation.

More
5 years 2 weeks ago #73418 by holch
For the first part, I think you don't even have to do it via Javascript. I think "INSERTANS" works with the custom variables as well. But I am not 100% sure there.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form