Workarounds: Further solutions provided by LimeSurvey users
From LimeSurvey Manual
Here you can find workarounds/solutions provided by LimeSurvey users which do not deal with these workaround sections:
- Workarounds: Question design, layout and templating
- Manipulating a survey at runtime using Javascript
- Survey behaviour.
If you are looking for general troubleshooting please check our General FAQ and Installation FAQ. If you can't find a solution for your problem please open a new thread at our forum or ask at our live chat.
Therefore we can't give support for any solution on this page.
Please contact the users that, thankfully, shared their solutions with the community if you have any questions.
How to import survey responses from v1.00 into v1.5x (and later)
Tested with: LS >= 1.50
In LimeSurvey v1.50 it´s possible to import a survey, which is generated (and exported) with v1.00 into v1.5x. The Problem is, on that way only the survey structure gets imported, but no respones to that survey.
If you also need to import the responses, follow the next steps:
- Export your survey in v1.00
- Do a VV-Export in v1.00 (to save your responses)
- Import your survey from v1.00 into v1.5x via "Create or Import a New Survey" in the main Admin Panel
- Activate your imported survey
- Fill out your survey once, so that at least one response is in your database.
- Do a VV-Export in v1.5x
- Open both VV-Exports (v1.5x and v1.00); if you use Microsoft Excel do it via "Open New File" and "Import from Text-File" or "Import from external source - textfile" and choose "seperated" and "Unicode (UTF-8)"; choose
- Compare the file structure and you´ll see that there are two columns added (submitdate and startlanguage) and that all question codes changed.
- Copy all rows (except row 1 and 2, that means you start with the third row) from your VV-Export v1.00 into your VV-Export v1.5x (also put it at the third row)
- Add the columns "submitdate" and "startlanguage" in your VV-Export v1.5x-File, right between "id" and "token"
- Save your file (in Microsoft Excel use Textfile - Tabstopp seperated). It´s necessary that your file after saving has the same format as before - Notice: it´s not a normal .csv-File.
- Import your file via VV-Import
Translate surveys without admin access
Tested with:
User "CasN" has written a nice extension that allows you to translate surveys without having access to the admin panel. He has added his files in the bug and feature tracker (01735: Remote translating feature) where you can download them. You'll also find a short How-To there.
This is how it works:
Copy the scripts in the root of your survey directory and call starttrans.php like this starttrans.php?survey=12345
It will check the languages connected to the survey and also verify the labelsets used.
You will then get a screen with for each language the required links for translating, aswell for the labels as the survey itself. From the survey, the question and tip fields are presented for translation.
Thanks CasN for sharing your solution with the community!
Create Question Pools
Tested with:
This is a simple solution to create question pools for LimeSurvey. It will require access to the backend database. I'm not going to explain how to do this, as if you don't understand it, then you shouldn't really do it.
Basically 3 tables exist that we care about:
- lime_surveys - id field = sid
- lime_groups - id field = gid
- lime_questions id field = qid
In order to show the questions correctly the id field from the lime_groups table exists in the lime_questions table. This then is used to create the parent/child relationship.
However, if you want to create a pool of questions all you need to do is to amend the gid field in the lime_questions table to a value that doesn't exist in the lime_groups table. I would use 0 or a something silly like 10000. Try this with one question and you will notice it doesnt appear in the question list.
It's a crude workaround, but allows you to create as many questions as you want, without having them visible.
This could also be applied for groups as well just by using the sid field in the lime_groups table.
Re-open a submitted answer
Tested with: 1.71+
As an administrator you can re-open a submitted answer.
- Reset tokens invitation to not sent
- Reset answers to not completed
- release <= 1.72: In LS <= 1.72 you don't have the option to "Reset answers to not completed" that version 1.8 offers, so this would require the following workaround:
- export of tokens
- vvexport of answers
- deactivate/activate survey in order to erase answers
- import answers from VVimport but Add the 'import as not finalized answers' option
- import tokens
- release >= 1.8:
- from the answer summary page, a new option can be used to reset all answers to a not submitted state
- from the tokens summary page, you can reset all tokens to 'not sent' state
- release <= 1.72: In LS <= 1.72 you don't have the option to "Reset answers to not completed" that version 1.8 offers, so this would require the following workaround:
Note that this will work only on non anonymous surveys with "Allow Persistence" option set.
Bypassing email check at registration
When you allow public registration to your survey LimeSurvey developers have opted to put in place a certain level of protection from bots and spammers by placing a captcha and by forcing the users to go and check their emails to find the link associated with their tokens.
Sometimes, however, this is a nuisance that actually force people to wait for the email when they would rather just take the survey and get on with things. Ideally it would be great if a token-based survey present the participant a short-text box (like a security question) asking at random one of the field in the registration form when the token is passed via URL (i will put this as feature request for the next edition!).
In the meantime, there is a very easy workaround. The solution is to edit the register.php and add the following code around line 156 (where the code is rewriting the page with the message that the email has been sent):
<a href='$publicurl/index.php?sid=$surveyid&token;=$newtoken⟨=$baselang'>Whatever you want to say</a>
I placed right on line 156 between the two line breaks. The code is simply creating a link to the survey embedding the token in the URL.
NOTE that this is literally bypassing the safety currently in place, but the advantage is streamlining the steps for taking the survey with registration.
Alternate Bypassing Email Check at Registration
For version 1.87, please add the following code on line 180 above the //PRINT COMPLETED PAGE in register.php. This will take the user directly to the welcome page without any pauses in between and bypasses the user having to go to the email validation to start the survey.
header("Location: $publicurl/index.php?sid=$surveyid&token;=$newtoken");
- Zad Imam 04/20/2010
Used email and public registration
Tested with v1.8
When you have a closed survey with public registration, currently LimeSurvey is not allowing a user to re-use the same email. This is a problem if the user has deleted the registration email without taking the survey. In the above workaround a user was allowed to take a survey by presenting a link straight after the registration; ideally they should be prompted with an additional security question and/or captcha (see bugtracker). In the meantime, this owrkaround allows you to from a link from the corresponding email and present it to the user.
Make sure you back up your register.php first!
Here the querystring has been modified to pull out the token as well as the email address and the error message has been changed to display the link to the survey for the existing token. Please also note that this forced change will not be reflected in the different languages!
Around line 75 find the corresponding code:
//Check if this email already exists in token database
$query = "SELECT email,token FROM {$dbprefix}tokens_$surveyid\n"
. "WHERE email = ".db_quoteall(sanitize_email[['register_email']]);
$result = $connect->Execute($query) or safe_die ($query."<br />".$connect->ErrorMsg()); //Checked
if [[$result->RecordCount(]] > 0)
{
//transform in array of values
$row=$result->FetchRow();
$register_errormsg=$clang->gT("The email you used has already been registered.")."<br><br>".
"<a style='color:red;font-weight: bold;' href='$publicurl/index.php?sid=$surveyid&token;
= ".$row['token']."⟨=$baselang'>Click this link to take the survey now</a><br><br>";
include "index.php";
exit;
}
HTTP-Refferer is not shown after a Redirect
There are different ways to redirect a page, just as HTTP-Redirect 301, meta http-equiv="Refresh", meta http-equiv="Referrer", link rel="canonical" or JavaScript window.location. But all of them don't work correct in all Browsers when it comes up to the HTTP-Referer. The only working solution I found is with a bit strange JavaScript. You see the solution at [1]
Provide a preview-all-questions page for any survey
Sometimes people would like to be able to preview all questions in a survey before actually taking the survey - it gives them a chance to prepare their information in advance. While the LimeSurvey admin tool lets you create a printable version of a survey, this is not really appropriate for end users, as it contains placeholders for token values, etc. So, for our installation I created a separate PHP script, which you can install on your server and provide for users. Further notes are in the body of the script:
<?php
/******
PreviewLimeSurvey.php
Displays an HTML page with a preview of all questions in the specified survey; multiple-choice and array questions are displayed with all possible responses listed out. Mandatory questions are displayed with "(* REQUIRED)" after the question text.
Usage: Pass the 5-digit survey ID, e.g.: http://{some_path}/PreviewLimeSurvey.php?sid=nnnnn
Preparation:
- In the calls to mysql_connect() and mysql_select_db(), substitute the parameters for your own LimeSurvey server and database
- In the HTML part, modify styles and page title as desired
- This code presumes your LimeSurvey database tables use standard nomenclature: lime_questions, lime_answers, etc. If that is NOT the case, you will need to modify table names in the queries.
CAVEATS:
- This does not handle ALL LimeSurvey question types. The default behavior is to print just the text of each question. It then adds additional info for specific types that include lists of options, array tables, etc., but you may need to modify the code to handle all the types that you use.
- It does NOT print boilerplate questions (type 'X'), because in our setup these would be irrelevant when someone just wants to preview the survey questions. You can change this by commenting out the clause "if ($row['type'] != 'X')"
*/
// Put the page parameters in globals
$mySID = $_GET['sid'];
// Preview questions and possible responses for the specified survey ID
function preview_survey($sid) {
$dbh = mysql_connect('myHost', 'myLimeSurveyDatabaseUsername', 'myLimeSurveyDatabasePassword');
mysql_select_db('myLimeSurveyDatabaseName', $dbh);
// Start by getting survey name from db, to display in title
$result = mysql_query("SELECT surveyls_title FROM lime_surveys_languagesettings WHERE surveyls_survey_id={$sid}");
$row = mysql_fetch_assoc($result);
$output = "<h2>Survey Preview: {$row['surveyls_title']}</h2>"; // Initialize markup with heading showing survey name
$output .= '<div style="margin:15px 0 15px 1em;width:30em;">Below are questions that will appear on your survey.</div>';
$result = mysql_query("SELECT lq.qid, lq.sid, lq.gid, lq.lid, lq.type, lq.title, lq.question, lq.mandatory, lg.group_order FROM lime_questions AS lq, lime_groups AS lg WHERE lq.sid='{$sid}' AND lg.sid=lq.sid AND lq.gid=lg.gid ORDER BY lg.group_order ASC, question_order ASC");
while ($row = mysql_fetch_assoc($result))
{
// For all questions *except* Boilerplate (type X), print out the main question text
if ($row['type'] != 'X') {
if ($row['mandatory'] == 'Y')
$isMandatory = ' <span style="color:red;">(* REQUIRED)</span>';
else
$isMandatory = '';
// Grab the question text and put in a <div>, first filtering it thru stripFinalBrk(); this strips out the final break tag that appears
// in many of the questions, which can mess up our formatting (break tags INSIDE the question text are left alone)
$output .= '<div class="qText">' . stripFinalBrk($row['question']) . $isMandatory . '</div>';
// Get array of possible options: This will be empty for some question types
$qOpts = mysql_query("SELECT answer FROM lime_answers WHERE qid={$row['qid']} ORDER BY code ASC");
$numOpts = mysql_num_rows($qOpts);
}
switch ($row['type']) { // Process output based on question type
case 'Q': // Multiple short text
case 'P':
case 'K':
case 'L':
$output .= '<ul style="margin:0;">'; // Begin tag for bulleted list of options
// Populate an array of options listed for this question
while ($rowOpts = mysql_fetch_assoc($qOpts))
$output .= '<li>' . $rowOpts['answer'] . '</li>';
$output .= '</ul>';
break;
case ';': // Mandatory multi-choice flex labels (tabular display)
$output .= '<div style="margin-left:2em;"><table border="1" cellpadding="4"><tr>';
// Get labels for columns and create top table row for output
$output .= "<th> </th>"; // 1st column where row labels will go
$qColumns = mysql_query("SELECT title FROM lime_labels WHERE lid={$row['lid']} ORDER BY sortorder ASC");
$numColumns = mysql_num_rows($qColumns);
while ($colOpts = mysql_fetch_assoc($qColumns)) {
$output .= "<th>{$colOpts['title']}</th>";
}
$output .= "</tr>";
// Create one row per option. The row labels will be the $qOpts we already got. Use these for 1st column, fill others with blanks
while ($rowOpts = mysql_fetch_assoc($qOpts)) {
$output .= "<tr><td>{$rowOpts['answer']}</td>";
for ($i=0; $i < $numColumns; $i++) { // Fill in blank columns under the column heads output above
$output .= "<td> </td>";
} // end $i
$output .= "</tr>";
} // end while ($rowOpts)
$output .= "</table></div>";
break;
case 'Z'; // Flexible drop-down/radio-button - user selections come from lime_labels; here, show all possible options
$output .= '<ul style="margin:0;">'; // Begin tag for bulleted list of options
$qLabels = mysql_query("SELECT title FROM lime_labels WHERE lid={$row['lid']}");
while ($rowOpts = mysql_fetch_assoc($qLabels)) {
$output .= '<li>' . $rowOpts['title'] . '</li>';
}
$output .= '</ul>';
break;
default: // For any type not specified above, no further output after displaying the question text
break;
} // END: switch ($row['type'])
} // End main loop thru survey questions (while ($row....)
return ($output);
}
/******
stripFinalBrk(): Test if string ends with a <br /> tag, and if so remove it; returns modified string.
*/
function stripFinalBrk($myString) {
$yerString = strrev($myString); // Reverse input string for testing
// Check if *reversed* string begins with a <br /> tag (backwards) - if so, strip out starting characters and return the rest
if (substr($yerString,0,6) == '>/ rb<')
$yerString = substr($yerString,6);
return(strrev($yerString)); // Reverse back for result
}
?>
<html>
<head>
<title>LimeSurvey Preview Page</title>
<style>
body {
font-family: Helvetica, Verdana, sans-serif;
padding:1em 0 2em 1em;
font-size:0.9em;
}
td, th {
font-size:0.8em;
}
li {
font-size:0.9em;
}
h2 {
color:#00A;
}
div.qText {
margin:1em 0 0.5em 0;
padding:0.5em 0 0.2em 0;
border-top: solid 1px #00a;
/* border-bottom: solid 1px #00a; */
}
</style>
</head>
<body>
<?php echo(preview_survey($mySID)); ?>
<hr style="margin-top:15px;" />
</body>
How to export a clean up-to-date .doc questionnaire directly from LimeSurvey
Once we have programmed a questionnaire we sometimes need to export it back. For example, we have made some changes directly in the interface, and would like to save them in a human-readable way for reference. Or, maybe our client needs to make some changes in the plain old .doc format.
While LS lacks such a function it is still possible to do this with free software and a little effort.
Step 1: go to the printable version of your questionnaire
Step 2: using your browser save the html file of the questionnaire locally.
Step 3: open the file using Libre Office.
Step 4: save/export the document as .doc.
Step 5: beautify the result. In your word processor of choice you may want to align all text to the left and use some automated way to put a border on your tables (use this http://www.thedoctools.com/index.php?show=mt_tableborder if you have MsWord)
That's it. Now you have a file that can be sent to your clients or edited.
Notes
For step 2, you may actually want to consider exporting to PDF by using a PDF printer as Bullzip PDF or CutePDF. Your partners may use one of the many PDF annotation tools to comment. On the plus side, it will look a bit better, keeping checkboxes and stuff.
However, not all people are comfortable using this. Even more importantly, I have found that when it exports questionnaire logic in human-readable form the text becomes hard to follow or even stops making sense.
For step 3 you can, theoretically, use other tools like Word or OpenOffice. However the matrix-intensive survey I used for testing crashed all software except LO. Depending on the questionnaire you may need to take other decisions.
Notepad++ macro to replace . with;
If you try to paste a list like this
1. option1
2. option2
... into the quick add box in LimeSurvey it will likely not wok out nicely because it will keep the numbering in the label of the option. However if you change it to ...
1; option1
2; option2
... it will work just fine, creating both codes and labels. I have created a Notepad++ macro that replaces the . following numbers up to 30 with ; , provided that all numbers are at the beginning of the line.
To install it you must
1. Close Notepad++ and keep it closed (otherwise it will override your work)
2. Search for shortcuts.xml in the program folder
3. Open it with another text editor
4. In the macro section paste the code below.
Note that N++ does not have something like an "echo off" command, so you will get lots of feedback from the program while the macro runs. However, I have created several smaller macros so that you may want to choose based on how wide your numbers range. (It will all come clear once you actually run the macro)
Now the code:
<Macro name="format.1to5" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n1." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n1;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n2." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n2;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n3." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n3;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n4." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n4;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n5." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n5;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
<Macro name="format.1to10" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n1." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n1;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n2." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n2;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n3." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n3;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n4." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n4;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n5." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n5;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n6." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n6;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n7." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n7;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n8." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n8;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n9." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n9;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n10." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n10;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
<Macro name="format.11to20" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n11." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n11;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n12." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n12;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n13." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n13;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n14." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n14;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n15." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n15;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n16." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n16;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n17." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n17;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n18." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n18;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n19." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n19;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n20." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n20;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
<Macro name="format.21to30" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n21." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n21;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n22." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n22;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n23." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n23;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n24." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n24;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n25." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n25;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n26." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n26;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n27." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n27;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n28." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n28;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n29." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n29;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="\n30." />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\n30;" />
<Action type="3" message="1702" wParam="0" lParam="512" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
<Macro name="home" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
</Macro>
Procedure to translate all surveys in the desired language quick and easy
Step 1: Setup LimeSurvey
- Install all new fonts in the Computer/ Server
- Add language folders in ~\htdocs\locale
- Go to ~\htdocs\application\helpers and insert commands for the desired languages in SurveyRuntimeHelper.php
- Go to ~\ htdocs\third_party\ckeditor\_source\plugins\font and edit Plugin.js file using notepad++. Press ctrl+f and search for ‘verdana’. Add all the fonts that you have installed in step A.
- Go to ~\htdocs\third_party\ckeditor and edit ckeditor.js file using notepad++. Press ctrl+f and search for ‘verdana’. Add all the fonts that you have installed in step A.
Note: Step 1 is to be performed only once. You can skip this step for all subsequent projects.
Step 2: Export Survey
- Export your Survey in .txt (UTF-8 format).
- Open the .txt file in excel.
Step 3: Import Translations
- Look for the language code in the .txt file. Copy all ‘en’ entries of the questions (with their respective answer options) on a new excel sheet.
- Now open the translated excel sheet shared by the client and perform vlookup. Check for errors and incomplete translations.
- Once all translations are done, copy the translated entries and paste them in automated translations.xlsx sheet.
- Final step. Now, copy the output generated from the automated translations.xlsx sheet and paste it in the .txt file.
Step 4: Save and Upload
- Save the .txt file in the same format i.e. Tab Delimited.
- Now open LimeSurvey and Import the survey.
Provide a basic statistic without the need of an user account (for example to provide a stat for your client)
This PHP script shows the number of the participants of surveys and the development of the participations presented with a Google Line Chart. There are three key-features: 1. The necessary survey ID's and the title of the project are provide with GET variables so anyone can set up the statistic without the need to adapt the source code 2. The client can see the development with the help of Google Charts 3. Real time count of the overall number of participants
Further the script can handle also surveys where the dates weren't logged and the surveys can also be mixed.
All you need is to provide a URL following this pattern http://yourdomain/survey_stat.php?survey=1010101,2020202,3030303&title=Client%20Name
survey= Here you provide the survey ID's from one or different surveys (when the client runs more than one survey or you want to compare different surveys) title = Here you provide the title
That's it. It is pretty easy and can be set up from anyone.
Here is the full script ready to go with google JS and HTML code:
<?php
//Connect to the database you use for limesurvey
try {
$db = new PDO('mysql:host=yourhost.com;dbname=lime_db', 'user', 'pass');
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
function participants_pd($sid, $db) {
//get the number of participants for each day of the survey
$facts = array();
$x = 0;
if(!is_numeric($sid)) {
echo "Survery ID must be a valid number";
exit();
}
else {
$survey_tbl = "lime_survey_".$sid;
$query = "select date(`submitdate`) AS date, count(`id`) AS number from `$survey_tbl` where `submitdate` != 'NULL' group by date(`submitdate`)";
$stmt = $db->query($query);
while($r = $stmt->fetch(PDO::FETCH_OBJ)) {
$facts['date'][$x] = $r->date;
$facts['count'][$x] = $r->number;
$x++;
}
$db = null;
return $facts;
}
}
function participants_sum($sid, $db) {
//get number of participants of the survey
if(!is_numeric($sid)) {
echo "Survery ID must be a valid number";
exit();
}
else {
$survey_tbl = "lime_survey_".$sid;
$sum = "";
$survey_tbl = "lime_survey_".$sid;
$query = "select count(`id`) AS sum from `$survey_tbl` where `submitdate` != 'NULL'";
$stmt = $db->query($query);
$r = $stmt->fetch(PDO::FETCH_OBJ);
$sum = $r->sum;
return $sum;
}
}
function titles($sid, $db) {
//get the titles
$title = "";
$query_t = "select `surveyls_title` from `lime_surveys_languagesettings` where `surveyls_survey_id` = :sid";
$stmt_t = $db->prepare($query_t);
$stmt_t->bindParam(':sid', $sid);
$stmt_t->execute();
$r = $stmt_t->fetch(PDO::FETCH_OBJ);
$title = $r->surveyls_title;
return $title;
}
//Getting the ID's of the surveys
if(isset($_GET['survey'])) {
$titles = array();
$participants = array();
$surveys = array();
//check if there are more then one surveys-ids
if(preg_match("/,/", $_GET['survey'])) {
//there are more then one survey
$surveys = explode(",", $_GET['survey']);
}
else {
$surveys[] = $_GET['survey'];
}
foreach ($surveys as $key => $value) {
//Get the number of participants for each day of the survey of each survey
$arrayname = "survey".$value;
${$arrayname} = participants_pd($value,$db);
//Get number of participants for the whole periode
$participants[] = participants_sum($value,$db);
//Get the titles of the surveys
$titles[] = titles($value,$db);
}
}
/**
* generating the data string for the google chart
* Will look something like that:
* ['Day','Title S1','Title S2','Title S3'],
* ['2013-10-08',35,462,101],
* ['2013-10-09',15,101,33],
* ['2013-10-10',7,37,10],
* ['2013-10-11',5,14,1],
* ['2013-10-13',2,10,1]]);
*/
//First the column names of the chart (in our case Day and the titles )
$data = "['Day'";
foreach ($titles as $key => $value) {
$data = $data.",'".$value."'";
}
$data = $data."]";
//Check which survey the most days
//The x-axis of the chart will filled with the dates of this survey
$max = 0;
$max_sid = "";
foreach ($surveys as $key => $value) {
$arrayname = "survey".$value;
if($max < count(${$arrayname}['date'])){
$max = count(${$arrayname}['date']);
$max_sid = $key;
}
}
//fill in the numbers of participants
$x = 0;
while ($x < $max) {
$data = $data.",['".${"survey".$surveys[$max_sid]}['date'][$x]."'";
foreach ($surveys as $key => $value) {
$arrayname = "survey".$value;
if(!empty(${$arrayname}['count'][$x])) {
$data = $data.",".${$arrayname}['count'][$x];
}
else {
$data = $data.",0";
}
}
$data = $data."]";
$x++;
}
//$data contains now a string with the JS Data Array
//<?=$data has to be placed in the JS containing the google chart function
//Setting the title of the site (can be the name of the project or of the costumer)
$title = "Development of the numbers of participants ";
if(isset($_GET['title'])) {
trim($_GET['title']);
htmlentities($_GET['title']);
$title = $title.$_GET['title'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?=$title?></title>
<style type="text/css">
body,html {
font-family: Droid Sans;
font-size: 13px;
margin:0px;
width: 100%;
height: 100%;
background-color: grey;
}
h1 {
font-size: 18px;
background-color: white;
margin-left: 0px;
width: 50%;
padding: 5px;
}
h2 {
font-size: 15px;
}
.stat {
width: 50%;
background-color: white;
padding: 5px;
}
.stat_li {
width: 25%;
float: left;
text-align: right;
}
.stat_re {
width: 45%;
float: left;
margin-left: 5%;
font-weight: bold;
}
</style>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
//set up the chart
//check out https://developers.google.com/chart/ for more options
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
<?php
if(isset($_GET['survey'])) {
?>
function drawChart() {
var data = google.visualization.arrayToDataTable([
<?=$data?>
]);
var options = {
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<?php
}
?>
</script>
</head>
<body>
<h1><?=$title?></h1>
<h2>Overall participants</h2>
<div class="stat">
<?php
if(isset($_GET['survey'])) {
$x = 0;
foreach ($participants as $key => $value) {
echo "<div class='stat_li'>".$titles[$x].":</div><div class='stat_re'>".$value." Participants</div><div style='clear:both;'></div>";
$x++;
}
}
?>
</div>
<h2>Development of the participation</h2>
<div id="chart_div" style="width: 51%; height: 50%;"></div>
</body>
</html>
Import & show data into a Google Drive Spreadsheet
Tested with: LS >= 2.05
You can import any data (e.g. list of surveys or users, selected answers) stored in your limesurvey database using the "IMPORTXML" function.
- Create a XML file to structure and print needed data (you should access it at http://mysite.com/myxml.php )
- In your spreadsheet use the following format (pasting in a cell):
=IMPORTXML("http://mysite.com/myxml.php?refresh=&GoogleClock()", "//mytaglabel")
To protect your XML file(s) from direct access you can put them in a dedicated folder and use a .htacess file to limit the access exclusively to Google Apps web crawlers filtered by ip ranges
order allow, deny
deny from all
# allow from your_ip
allow from 66.249.64.0/19 # Used by User-Agents 'apps-spreadsheets' & 'Feedfetcher-Google'
allow from 66.249.80.0/20 # Used by User-Agents 'apps-spreadsheets' & 'Feedfetcher-Google'
allow from 64.233.160.0/19 # Used by 'GoogleApps' UA
# Uncomment if necessary following ther IP ranges commonly used by Google INC.
# allow from 46.108.0.0/18 64.18.0.0/20 66.249.80.0/20 72.14.192.0/18 74.125.0.0/16 173.194.0.0/16 207.126.144.0/20 209.85.128.0/17 216.239.32.0/19
PHP (XML output) file sample.
The following php file will generate an XML view printing ID, STARTDATE and STARTLANGUAGE values of a survey.
<?php
/*
- This php file will generate an XML file showing ID, STARTDATE and STARTLANGUAGE values of a survey.
- Please edit variables for db credentials and survey id ($sid)
*/
header('Content-type: application/xml; charset=utf-8');
header ('X-Robots-Tag: none', true);
// Fetch database credentials (much better outside the wwww root directory)
// ************************
$dblocation = ' ';
$dbname = ' ';
$dbuser = ' ';
$dbpwd = ' ';
// ************************
// Create db connection
$conn = new mysqli($dblocation, $dbuser, $dbpwd, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Start XML output
echo "<?xml version='1.0' encoding='utf-8'?>";
echo "<answers>";
// Define survey ID
// ************************
$sid = "1234";
// ************************
$sql = "SELECT id, startdate, startlanguage FROM lime_survey_".$sid." ORDER BY 'id' LIMIT 100";
// $sql = "SELECT 1234X56X789, id, startdate, startlanguage FROM lime_survey_".$sid." ORDER BY 'id' LIMIT 100";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<item>\n";
echo "<id>".$row["id"]."</id>\n";
echo "<startdate>".$row["startdate"]."</startdate>\n";
echo "<startlanguage>".$row["startlanguage"]."</startlanguage>\n";
// echo "<anylabel>".$row["1234X56X789"]."</anylabel>\n";
echo "</item>\n";
}
} else {
echo "something is happening here but you don't know what it is";
}
echo "</answers>";
// Close db connection
$conn->close();
?>
Force HTTPS only for admins (not survey takers) with .htaccess
Add this to your .htaccess in the Limesurvey installation folder. And replace the myLimeFolder and domain name to whatever you have repecively.
# ALL ADMIN TO SSL
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} myLimeFolder/index.php/admin
RewriteRule ^(.*)$ https://myserver.com/myLimeFolder/index.php/admin/$2 [R,L]
Pre-filling a lot of answers in a survey
There are three things necessary to pre-fill questions easily in LimeSurvey:
- A token table that will store the prefill values loaded from the csv file
- A table (a .csv file works well), with the prefill values
- Code to copy the prefill values where they need to go
Let's assume you have a survey completed except for not having set up prefilling of questions. Note that, if all your questions are of a simple type (no array type or multiple choice questions), you don’t need the third step, and you can simply use the "Edit default answers" button to assign the values.
The place to start is adding a bunch of attributes to the regular token table. At some point, according to the documentation, it was possible to specify how long each of the additional attributes should be. In my current version (2.50+) this is no longer a part of the token management screen, and all the tokens created have length 255. This means that you rapidly run out of space in the tokens table (at about 85 columns in utf8 character set). Limesurvey is perfectly happy if you downsize the columns, which you can do by running an "alter table modify …" on columns of the lime_tokens_<sid> table. MySQL does not allow the SQL variant dealing with more than one row at a time, so most efficient is to write a script to create the one-column-at-a-time statements, e.g.:
select CONCAT('alter table lime_tokens_<SID> modify ',COLUMN_NAME,' varchar(10);')
from information_schema.COLUMNS
where TABLE_NAME = 'lime_tokens_<SID>'
and COLUMN_NAME like 'attribute%'
and table_schema = 'limesurvey'
Once you have added the raw columns (which will be called attribute_1 to attribute_n) you can give them more meaningful names. This is of limited practical value (see below), but should help keep you organized.
The values that you import into the token table presumably come from a database somewhere. Whatever method works best to create a CSV file with the attribute data in it is good. The csv should have:
- At least three of the regular token table columns: firstname, lastname, email, but it can have any of the other standard columns you need (obviously with prefills you will not be doing anonymous surveying), as well as the attribute columns you use for prefilling.
- Columns called attribute_1 through attribute_n. The columns cannot be called by the alias names that you might have given them in the first step. Clearly this means that you (as the programmer in the database from which the information is being brought), need to have some sort of concordance list that tells you that "attribute_23" is the data of birth of the 3rd child (or whatever). In limesurvey the concordance is stored in JSON in the attributedescriptions column of the appropriate row in the lime_surveys table. You can extract it in MySQL using "select attributedescriptions from lime_surveys where sid = <whatever>", and you should then be able to format it with one row per line and use that to guide writing the .csv file.
Alternatively, when you export the token table, the column headers will look like "attribute_8<ISElig>" which you could transpose in Excel to use as the list. In my case I created a table in the database with meaningful column names , and then had to write a query to turn then back into columns named attribute_1 through attribute_n, like:
select firstname "firstname",lastname "lastname",email "email",
case_id "attribute_1",
reviewer "attribute_2",
SID "attribute_3",
laststage "attribute_4",
closedfrom "attribute_5",
Consent "attribute_6",
EIelig "attribute_7",
ISelig "attribute_8",…
- The values that you put in the .csv file will be most useful to you if they correspond to the Code of your possible responses. If, for example, your answer options screen gives a code = A1, answer option = "Yes", then "A1" is what you want in your data. If you don’t do this you will need to do something like the method mentioned in the last bullet below.
d. You import the csv data into limesurvey using the "Create tokens" button and the "Import tokens from CSV file" option.
The third part of the process is to write the code to copy the values from the token table to the survey variable for which they are required. The place to put this code is in the Question box of an question that is of type "Equation", and which has an advanced setting of "Always hide this question" = "Yes".
The ExpressionScript (introduced about version 1.96) makes assigning the values from the TOKEN to the survey field quite easy. Each assignment should look something like:
{II2_1 = if(is_empty(II2_1),TOKEN:ATTRIBUTE_7,II2_1)}
If you look in the forums you will see answers circa 2011 where it was necessary to write little javascript functions to prefill the values. This is no longer necessary.
Note that:
- The whole expression is enclosed in curly braces
- Case is important (for the survey column names and the token attribute)
- The "if(is_empty(..)" part of the expression prevents you overwriting values that the person filling in the survey has already manually changed.
- In the above example, II2 is the question code, and the _1 denotes the first element of the array. More strictly the "1" is the code of the array element. If the code was SQ1 then you would use _SQ1, and so on.
- Above I stated that there was little practical value in naming the attribute columns. If you click on the lime in curly braces icon at the top of the question box (second icon), you will get a list of the attributes in the token file with their meaningful names. This is nice, but when you select a particular token, the TOKEN:ATTRIBUTE_x gets added to your box surrounded by curly braces. That would be fine if you were trying to customize text in the box, but it's not good within our assignment statement: it's a syntax error. You then have to go to the Source screen to remove the braces, so it is probably just as quick to type TOKEN:ATTRIBUTE_x , assuming you have your list handy.
- You can add multiple EM assignment statements in a single question.
- If your token attribute is not actually what you need to put into the survey variable, then you can use an "if" function to transform it, e.g. your imported data has 'Yes' and you need to set the variable to A1, otherwise A2 use:
§ If(TOKEN:ATTRIBUTE_7=="Yes","A1","A2")
Insert a JavaScript file into a custom admin theme (LimeSurvey 2.06)
- Create your own admin template - see Custom Admin Themes
- Add a custom JavaScript file to your new template directory
- Extract the attached insertAdminJS plugin folder in your /plugins directory
- In Plugin manager, activate the "Insert Custom Admin JS File" plugin
- If you have named your custom JS file something other than "custom.js", go to the plugin settings and enter the filename
You will then see the custom JavaScript file inserted into all admin pages: