Welcome to the LimeSurvey Community Forum

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

Storing survey answers back into participant database attributes

  • falkenhorst
  • falkenhorst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago - 6 years 1 month ago #165046 by falkenhorst
Hi,

I'm using the XAMPP package with the LimeSurvey Community Edition (version 3.4.4).

Currently I try to figure out a solution based on LimeSurvey for the following scenario.

I would like to create a survey, which will be sent out on a regular basis (most likely once per year). This survey should contain a mixture of "normal" questions (i.e. the user is expected to actually fill in an empty answer field or is supposed to choose from a given selection) and contact data of this participant that we have stored and should be kept up-to-date.

So far I have found out that I can import my survey participants (stored in an MS Excel file which can be exported as .csv file) into the central participant database (CPDB) of LimeSurvey together with this additional contact data as attributes of the participants (for some reason the column headers have to be named according to the scheme "attribute_1", "attribute_2", etc. and can then be renamed during the import process, while naming the column headers in the .csv file directly led to a failure on import).

By preparing the default answers of the respective fields with placeholders for the token attributes like "{TOKEN:FIRSTNAME}" and "{TOKEN:ATTRIBUTE_2}" I can ensure that survey participants are presented with their contact data which has been imported into the CPDB. This way they are able to review and correct this data if necessary.

Now my problem is that I would like to create a backlink which stores the participants answers in the respective fields back to the corresponding attributes of this participant in the CPDB. Unfortunately, I could not find a way to achieve this using standard features of LimeSurvey.
However, I came across this topic which deals with a similar issue:

Topic:
www.limesurvey.org/forum/can-i-do-this-w...of-participant-table
Plugin:
framagit.org/SondagePro-LimeSurvey-plugin/updateTokenByResponse

I have downloaded the plugin (updateTokenByResponse) for LimeSurvey recommended in this thread, but I was not able to utilize it.
I copied the .php file to C:\xampp\htdocs\plugins but it does not show up in the Plugin Manager.
Am I using the wrong directory or is this an issue of version compatibility?

Also I'm not sure if I have to make adjustments to this code (do I have to include my participant's attributes directly in this code)?

Or is there a simpler way to achieve what I'm trying to do?

Any help/suggestions are highly appreciated. :)

Thank you in advance.

Kind regards,

falkenhorst
Last edit: 6 years 1 month ago by falkenhorst. Reason: Removed unnecessary blank lines
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 month ago #165047 by holch
The plugin is most probably not compatible with the newest version of Limesurvey, which just came out a few weeks ago.
As far as I know, the user Denis (the developer of this plugin) will be starting soon to adapt his plugins for the latest version. However, if you have a look at his site you will see that he has a lot of plugins, so this might take a while.

Looking at the link you gave, it seems that this plugin is not even compatible with the previous branch (2.5x):

Dev: preparing 2.5X compatibility
Denis Chenu authored 4 months ago


But I think he will not adapt it to the 2.5x branch anymore but go straight to 3.x, but these are only my thoughts and I have no deeper insights into Denis' plans on updating the plugins.

For now, you most probably will have to update the token tables manually.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: falkenhorst
The topic has been locked.
  • falkenhorst
  • falkenhorst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago #165087 by falkenhorst
Thank you for the quick response.

I had a closer look at the source code of this plugin and found out that by replacing the line
Code:
class updateTokenByResponse extends \ls\pluginmanager\PluginBase
with
Code:
class updateTokenByResponse extends \LimeSurvey\PluginManager\PluginBase
the plugin shows up in the Plugin Manager.

I'm not sure if this is the only adjustment required to make it work properly again, but right now I'm a bit confused about the configurations page of this plugin (please also see attached screenshot below).



The description says:
"Set the default value for each token, you can use Expression Manager, remind to use {} to activate expression manager. Expression is not validated, if there are error : this is not fixed. If the result of the expression is empty (trimmed) : attribute is not updated"

This is followed by a long list of text fields with labels saying "Value for firstname", "Value for lastname", "Value for email", "Value for attribute 1", ..., "Value for attribute 100".

I have entered values like "{TOKEN:ATTRIBUTE_1}" for "Value for attribute 1", etc., but it seems to have no effect in updating the respective participant attributes after the survey is completed. I wonder if this is due to my configuration of the plugin being incorrect or if it's a problem with the source code?

I understand that updating a participant's attributes is always possible, but what we would like to achieve is a reduction of the required manual adjustments after the survey has been completed, if possible.

Again, many thanks!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 month ago #165090 by Joffm
Hi, falkenhorst,

I saw this plugin now for the first time.

But as I understand, you have to enter into "Value for attribute 1" the respondents answer to a question.
You said

which stores the participants answers in the respective fields back to the corresponding attributes


So I think you have to enter something like {Q1}.

Just an idea.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: falkenhorst
The topic has been locked.
  • falkenhorst
  • falkenhorst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago #165147 by falkenhorst
Thank you for your suggestion.
That seems reasonable to me.
Thinking about it the usage of "{TOKEN:ATTRIBUTE_1}" (as stated in my previous post) didn't make sense to update the value of attribute_1 anyway (if it would work at all it would supposedly just update the token's attribute 1 with itself).

So I tried to configure the plugin with references to my corresponding question codes (e.g. "{orgName}" for the corresponding attribute where I would like to update the value with the participant's answer to the question with the code "orgName"), but unfortunately this had no effect either.

I suppose it will be a sufficient solution for me if I don't use the CPDB and simply always import the participants with their attributes anew from a csv file. The collected data from the survey will be exported as csv file anyway to extract a list with the updated contact data. For the next survey iteration I could then copy the survey of the previous year (and adjust the questions if necessary) and then import this csv file again to create the participants table.

My thought was just that it would be more efficient to add participants once to the CPDB with their attributes and update their attributes automatically with the corresponding results of the survey. For following surveys I would then only have to add the right participants from the CPDB to the participants table.

Actually it's (at least partly) rather a use case for a CRM system where (certain groups of) contacts at regular times should be presented with their contact data with the request to review and update them if changes have to be made. However, since this is connected with some "classic" or "normal" survey questions at the same time this makes it a mixture of both worlds (CRM and survey tool) and, therefore, makes it harder to achieve.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose