Insert Values from Survey Participants Table

Insert Values from Survey Participants Table

Insert value from the Survey Participants Table


You can insert values from the survey participants table into your question so that it can show context related information. Think of the participants first name or last name or email address.  For LimeSurvey to do this, the survey needs to be set as:
  1. not anonymous (i.e: tracked) and
  2. it needs to have a survey participants table created.
The following placeholders can be used within a question:

{TOKEN:FIRSTNAME} inserts the value from the "firstname" field located in the survey participants table
{TOKEN:LASTNAME} inserts the value from the "lastname" field located in the survey participants table
{TOKEN:EMAIL} inserts the value from the "email" field located in the survey participants table
{TOKEN:ATTRIBUTE_1} inserts the value from the "attribute_1" field located in the survey participants table
{TOKEN:ATTRIBUTE_2} inserts the value from the "attribute_2" field located in the survey participants table

To use any of the placeholders from above, you must type it/them as written above in the question field text.

For example:
Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}.

If you wish to further customize your questions, use the [[ExpressionScript - Presentation|ExpressionScript]].

For example, if you wish to make use of the tailoring technique, type in: <syntaxhighlight lang="php" enclose="div">What do you as a {TOKEN:ATTRIBUTE_1} think about your {if(TOKEN:ATTRIBUTE_1=='worker','bosses','workers')}?

You may also use JavaScript to achieve further question customization. First, you have to allow JavaScript to be used when setting up questions. This can be achieved by deactivating the XSS filter from the
global settings of your LimeSurvey installation. However, deactivating this option is not always a good idea - read the following wiki section
for further information.

Question tailoring via JavaScript:
Hello {TOKEN:FIRSTNAME}. We sent an email to you using this address {TOKEN:EMAIL}. Is this correct?

What do you as a {TOKEN:ATTRIBUTE_1} think about your <script type="text/javascript" language="Javascript">; var job='{TOKEN:ATTRIBUTE_1}'; if (job=='worker') { document.write ('bosses') } else { document.write('workers') } </script> ?