Welcome to the LimeSurvey Community Forum

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

What is the easiest way to pull global survey data and include in completed page

  • incredibles
  • incredibles's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 month ago #133193 by incredibles
I would like to be able to pull statistics from survey to include in completed page of every survey. The statistics should be calculated real time. Use case: polling.
The survey respondent should see one multiple choice question:
Who would you vote for:
1. Sanders
2. Clinton

After user submits, the completed page should show: (calculating from all respondents the percentage that have voted for Clinton and Sanders)
"You voted for Clinton, and so did 30% of all respondents.", or "30% of 300 respondents chose Clinton"

Is there a way to pull statistics with javascript or php by entering code on the template editor? I can pull just the respondent data and know how to work with that data, but I dont know how to pull data realtime from all respondents and aggregate the data for each survey completed page.

I can think of setting up a server app that accesses the database or api and pulls data and creates report pages, and then use the url redirect function to replace the completed page. But is there an easier way to do this through templates or built in reporting in limesurvey?

I appreciate any pointing in the right (easiest) direction.

thanks!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #133200 by tpartner
There is no built-in way to access previous results from within the survey. The solution would be, as you suggest, a remote file that queries the database. You could redirect to that file or make an AJAX call from the end screen.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: incredibles
The topic has been locked.
  • holch
  • holch's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago #133205 by holch
Maybe you can play around with the public statistics page.

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: incredibles
The topic has been locked.
  • incredibles
  • incredibles's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 days ago #135037 by incredibles
Thank you both for your suggestions. Can the new API be used to pull answers from all respondents? I see a mention of export in csv format, but is there actually an api call that will return json formatted answer results from a particular survey?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose