Welcome to the LimeSurvey Community Forum

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

Add column to "responses" table of survey with a plugin

  • Miratek
  • Miratek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #231217 by Miratek
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 5.3.14+220516
Own server or LimeSurvey hosting: Own Server
Survey theme/template: -
==================

Hey guys,

I'm developing a plugin. If an user participates on the survey, I can see all the responses on the page "responses" in a table (with columns like "completed" etc.).
But I want to write additional information to the database so the table shows another custom column, e.g. "successful" where PHP should define if a user gets a true or false (based on some variables). 
My approach is to use the afterSurveyComplete-Event. I can already show the responses via $this->pluginManager->getAPI()->getResponse($surveyId, $responseId);
But how can I set an additional variable there? How to write data to the database?

Greetings!

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 8 months ago #231219 by tammo
To add a new column to your responses tabel, you can also add a hidden question (text) with the question code "succesful"


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

  • Miratek
  • Miratek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #231226 by Miratek
That would be possible, yes. But I want that a limesurvey survey creator only needs to install my plugin and do not alter its survey (by adding additional questions).
Is there another way?

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 8 months ago #231229 by tammo
Well, yes, but then you would indeed need a plugin.

I am not good at that, possibly one of the other experts that hang around here may be able to help you.

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

  • Miratek
  • Miratek's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #231236 by Miratek
Thank you for your answers!
Yes indeed, my whole topic is about me developing a plugin :-)

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose