Welcome to the LimeSurvey Community Forum

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

In survey stats - show mean score of previously submitted responses

  • baybug
  • baybug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #223355 by baybug
Hello community!
I would like survey participants to be able to compare their mean score with the mean of all other previously submitted.
It looks like it should be relatively easy to compute the mean - however, I am doing something wrong as the function gives me the "red" error marking.

What I have done:
Created a equation type question. In the syntax field I have entered:
{questionid.moy2}

The function moy2 should calculate two cipher mean. The mean should NOT include responses that are empty (e.g. if a respondent has terminated the survey before completing the survey) - I am not sure if the function does this by default?

I would also like to show the participants the total number of responses the mean is based. For that I have created another equation type question with the information:
{statCount(questionid [ , submitted = true ])

Again - I get the red error highlight.

I hope some wizard out there can help out? I can also attach the survey structure if that is helpful.

Best,
Max


Please help us help you and fill where relevant:
Your LimeSurvey version: 5.1.16
Own server or LimeSurvey hosting: Own server
Theme:

==================
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #223358 by Joffm
Hi,
In the description of the plugin you see

Usage in Expression ManagerTo use this number in Expression manager : you must use the quote : for example

Code:
{if(('[Q.nb.A1]'-100)>0,"There are "+('[Q.nb.A1]'-100)+" before this answer is quota out","This answer is quota out")}
.

So, you should use
{'[questionid.moy2]'}
 {statCount(questionid [ , submitted = true ])
This is the definition of the function.
The brackets mean that this part is optional with the default value of TRUE.
{statCount(questionid)}
If you want to include the not submitted responses you have to add this
{statCount(questionid,FALSE)}

But why do you use two different plugins?
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Away
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 5 months ago #223361 by tammo
Joffm: for people that do not know here to look, this post is obscure.

What two plugins are you referring to?


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • baybug
  • baybug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #223365 by baybug
Thanks for your quick response.

I corrected as suggested above and I still get the red box regarding the statCount function and for the displaying of the mean it just displays the verbatim function.

I have not installed any plug-ins - I believed these functions would work by default with ver 5+. So this is probably an issue. You seem to suggest that I can do everything with one plugin. Which one? Where do I get it?

I really appreciate your time - it's really helpful :)
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Away
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 5 months ago #223367 by tammo
This is one: gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey

But I am curious to which other plugin Joffm refers.


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #223368 by Joffm
@tammo,
sorry, to have been obscure.
I was sure baybug knows what he uses.

"countStat" and "countStatIf" are the two function in the core plugin "statFunctions" which was introduced in 4.1.
[url] www.limesurvey.org/manual/StatFunctions [/url]

I corrected as suggested above and I still get the red box regarding the statCount function and for the displaying of the mean it just displays the verbatim function.

So you should send this relevant part of your survey as lss export.

I believed these functions would work by default with ver 5+. So this is probably an issue.

Did you activate it?
Sometimes you have to "Scan files" before.
 

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • baybug
  • baybug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #223373 by baybug
Thanks - I did run the "Scan files" and it found the "Statfunctions" plugin. I have now activated the plugin.
It does seem to have done something - but still not working properly.
When I run a "Preview" of the survey while it is deactivated it looks like it tries to count the number of previous responses - but comes up with "0" regardless of actual responses. When I activate it - nothing happens at all.

I have attached the .lss structure it would be wonderful if you are able to see what I'm doing wrong?
Best,
Max
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago - 3 years 5 months ago #223377 by Joffm
In a deactivated survey there are obviously no responses to count.
There is nothing stored.

And you have to add "sgqa" to the question code -> statCount(Q1,sgqa)

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 5 months ago by Joffm.
The topic has been locked.
  • baybug
  • baybug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #223396 by baybug
Thanks a lot Joffm - now it counts submitted responses. However, I still do not get a return of the mean of scores already submitted.

I have tried to enter several variations in the question equation without luck:
{'SCORE.sgqa.moy2'}
{'[SCORE.sgqa.moy2]'}
{[SCORE.moy2]}

SCORE is the question id.

Do I need to activate another plug-in or is it my syntax that is faulty?

I really appreciate you helping out - it is very useful. thanks :)
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #223402 by holch
As far as I know, moy2 is syntax from the plugin (not core!) gitlab.com/SondagesPro/ExportAndStats/getStatInSurvey

Where are you getting the infos about moy2 from?

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago - 3 years 5 months ago #223404 by Joffm
You said, you activated "statFunctions".
Did you upload and activate "getStatInSurvey"?

I tested your example.
Everything is fine with these two plugins - and the correct syntax.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 5 months ago by Joffm.
The following user(s) said Thank You: baybug
The topic has been locked.
  • baybug
  • baybug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #223405 by baybug
that was what i was missing. i installed the other plugin and now it is working fine.

in your first post you seem to indicate i can do what i wish to do with only one of the plugins - is that right?
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose