It's something that every frequent LimeSurvey user will have come across at one time or another. You have to build a list, or multiple option, or array type question, and the number of answers is really long.
Adding 3 to 4 answers to a question (or even 9 or 10) isn't too bad, but when you've got 20 or more, you'll usually find yourself cursing the awful slowness of having to save, reload the page, and type the next one. Wouldn't it be easier if you could edit it in a spreadsheet or something like that?
Well, you can. Using the export question/import question option you can now access a question using the Free and Open Source Spreadsheet software
GNUmeric. And you can edit questions/answers to your hearts content using that software.
This short tutorial explains how.
**
UPDATED **
Although there are many spreadsheet applications out there, GNUmeric is recommended because of it's capacity to save files as proper CSV files delimited with the double-quote string (or, in fact, any delimiter of your choosing). Why Excel or OpenOffice don't offer the ability to set options for CSV exports is beyond me, but they don't, and if you don't save your edits here as a CSV (comma delimited) file using the double quote character as a delimiter, then you won't be able to re-import it to LimeSurvey.
The GNUmeric spreadsheet software is a worthy addition to your computer application arsenal in any case as it is small, fast and very capable. It won't hurt to have it.
**
END UPDATE **
In summary, this process:
- creates a dummy question
- exports the question
- adds new answers in an external application
- imports the question with the new answers
- deletes the original "dummy" question
Let's assume you're creating a list type question.
Firstly, create your question, adding the question text and choosing the question type.
Having done this, click on the "Add/Edit Answers for this Question" icon to view the Edit Answers screen.
Add two or three answers in the usual method.
You have now built your base question. Adding 20 or so additional answers will take some time, so to do this in another application, you should now click on the "Export this Question" icon.
You'll be presented with your browsers Save/Open dialog box. Choose to open the file in GNUmeric.
Once opened on your local computer, you'll see the basic structure of the Question Export CSV file. It contains all the information LimeSurvey needs to build a brand new question, including the Question Information, the Answers, any associated LabelSets, and any Question Attributes.
For simplicity, you should avoid having labelsets or question attributes in your dummy question. You can change these later once you've re-imported the question.
To add questions, we need to scroll down the file to the section for the "Answers Table". Each answer has a row where the various elements of each answer is defined.
- qid
This is the unique database id code for the question you've imported. When you're importing the question later LimeSurvey will generate a new id to replace this one, so it's irrelevent - except that you need to include this on every line and it should always be the same number.
- code
This is the answer code, just like the one you set when using the LimeSurvey Edit Answers screen
- answer
This is the display text for the answer.
- default_value
The default value is either "Y" or "N". For simplicity always leave this as no. It can be changed later inside LimeSurvey
- sortorder
This field is usually hidden in LimeSurvey, but it is a number that determines in what order the answers display. LimeSurvey displays them in numerical order from lowest to highest. Each answer should have a unique, consecutive number in this field.
- language
This determines the language. Usually there will just be one. Leave this the same for all answers
So here's where we get to the good stuff. To add extra answers to your question you just need to insert new lines at the end of this section, and put the correct information for each answer on each line. In most cases only 3 fields need be different for each line - that is the
code, the
answer and the
sort_order.
Once you've added your extra answers in, save the file ensuring you keep it in the original CSV format.
Saving your file
- In Gnumeric, choose "Save as.." from the file menu.
- Change the file name, and ensure you select File Type "Text (configurable)"
- In the "Export as Text" option window make sure you've chosen a 'Comma' as the separator, and "Always" for "Quoting". Then save.
**
You are not done yet! **
There is still one final step to go.
Open your original question export file in a text editor such as notepad. Then open your newly created file in the same editor as a second window.
What we want to do at this point is replace just the actual data for the answers, and leave the rest of the file exactly as it is.
Having modified the answers to this question we want to cut out the old answer data, and paste in the new answer data, but otherwise leave the original file exactly as it was.
This image shows which bits we're cutting from the new file and where it will be pasted in the old file.
Once you've pasted the new answer data over the old answer data, save your original file.
Then, from your LimeSurvey screen, click on the "Add New Question to Group" icon and import your now modified original file.
The last steps are to delete the original dummy question, and then to move your newly imported question to the correct position in the group.
Once you've mastered the basic idea of editing an exported question file you might find it handy to keep a dummy question file floating around. In some cases, it may even be easier to build your questions using this file to start with, and then import it at the end. There's nothing stopping you getting creative, and modifying question data, or question attributes using this file either. Just be sure you know what it is you're changing.
I hope this is of use to those of you who regularly work with LimeSurvey. As always, your comments or suggestions are welcome and encouraged.
Jason
Thank you for your tips on LimeSurvey mass editing. It would be great, if you could provide as a link a sample questionaire file with 2 or 3 questions and different answers types associated so everybody could start from there and get an idea even quicker.
Cheers,
Xavier
Jason
this post is really good, helps me a lot on my survey.... but i have trouble with the type of question, wich is a table of numbers, so on the stats, must calculate by rows and cols.. and i guess would be easier to do it on .csv editor, but i have not idea about the format that the table ("question") must have, so im wondering you may help me to solve this out!,
thanks a lot for your help.
Do you mean you that you are wondering about statistics and the exported data from the survey?
Or are you wondering about the export of the question setup?
Jason
Any suggestions?