Welcome to the LimeSurvey Community Forum

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

Feature proposal for StatCount Plugin

  • jbarrouillet
  • jbarrouillet's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 months 1 week ago - 8 months 1 week ago #258236 by jbarrouillet
Feature proposal for StatCount Plugin was created by jbarrouillet
Your LimeSurvey version: V6.4.0
Survey theme/template: Fruity
==================
Hi,
I think it should be nice to upgrade StatCount Plugin with a SUM fonction on NUMERIC FIELD.

Example :
I need to make a survey to collect pledge of financial donation to a association.
I want to indicate, on a question texte, wich sum was collecte on the previous answers. To obtain this information, i need to make a SUM, on the previous answers, on a the numérical field "amount promised".

I'm looking on GetStatInSurvey but this plugin is not tested on V6 and Denis Chenu told me that StatCount is more powerfull.

Thanks for your interest on my request.
 
Last edit: 8 months 1 week ago by jbarrouillet.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 1 week ago #258253 by holch
Replied by holch on topic Feature proposal for StatCount Plugin
Hmmm, but that has nothing to do with the GetStatInSurvey or StatCount plugins, if I understand you correctly.

Because these are there to give you statistics about the different responses from different respondents. Like 55% so far have responded 'X".

From what I understand is, you want to sum responses given by the same person in the same questionnaire, right?

You can use expression manager/script to do this.

But maybe I understood you wrong.

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 1 week ago #258256 by Joffm
Replied by Joffm on topic Feature proposal for StatCount Plugin
No, it's really the sum of all previous responses in the survey.

Here part of the original question in the French part.

...to display a text display type question such as:
“We have already collected 22 pledges for an amount of X euros.
” X being the sum of a numeric field of responses already submitted. 22 being the number of responses.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, jbarrouillet

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 1 week ago #258258 by holch
Replied by holch on topic Feature proposal for StatCount Plugin
OK, then I read the initial proposal wrong.

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

Please Log in to join the conversation.

  • jbarrouillet
  • jbarrouillet's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 months 1 week ago #258300 by jbarrouillet
Replied by jbarrouillet on topic Feature proposal for StatCount Plugin

No, it's really the sum of all previous responses in the survey.

Here part of the original question in the French part.

...to display a text display type question such as:
“We have already collected 22 pledges for an amount of X euros.
” X being the sum of a numeric field of responses already submitted. 22 being the number of responses.

Joffm
 

YES, "it's really the sum of all previous responses in the survey".
Exactly like all the function count of StatCount, but, with SUM on a numérical question type.

Thank you

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 1 week ago #258302 by holch
Replied by holch on topic Feature proposal for StatCount Plugin
OK, so you get the information about collected pledges from different people and you want to show the sum of the pledges, understood.

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

Please Log in to join the conversation.

  • jbarrouillet
  • jbarrouillet's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 months 1 week ago - 8 months 1 week ago #258304 by jbarrouillet
Replied by jbarrouillet on topic Feature proposal for StatCount Plugin
It was an exemple, but yes, it's that i want to do.
An other example :
There is a manifestation with 40 places. We can subscribe 1 time with a name and a number of people wich will come. This field called "Number of people". I need to make a SUM on this field to compare 40 with the numbers of people wich will come. If it's over 40, i can't send the inscription.

Sorry for my english ! 
Last edit: 8 months 1 week ago by jbarrouillet.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 months 1 week ago - 8 months 1 week ago #258306 by holch
Replied by holch on topic Feature proposal for StatCount Plugin
Make sense.
However, here there will only be a discussion among users if a feature makes sense.

To make real feature request you need to go to bugs.limesurvey.org, switch to "feature request" (I think you can find it on the top right) and then describe your feature.

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

Last edit: 8 months 1 week ago by holch.
The following user(s) said Thank You: DenisChenu, tammo

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 months 1 week ago #258331 by tammo
Replied by tammo on topic Feature proposal for StatCount Plugin
I would support this.

Please mention the feature request that you define here, so people that read the forum (probably more people read the forum than the feature requests) can go to the feature request and add their support.

From my own experience I can say that when you mention that it is worth something for you (in euros or dollars) some plugin developer may want to help you sooner.... ;-)


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

Please Log in to join the conversation.

  • jbarrouillet
  • jbarrouillet's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 months 3 weeks ago #262987 by jbarrouillet
Replied by jbarrouillet on topic Feature proposal for StatCount Plugin
Hi,

In the @denis chenu's plugin GetStatInSurvey, add this code in GetstatInSurvey.php:


On line 221

case 'sumnum':
switch ($oQuestion->type) {
case "5":
case "L":
case "!":
case "O":
case "N":
case "*":
case "S":
return $this->getSumNumeric($this->iSurveyId."X".$oQuestion->gid."X".$oQuestion->qid, $sValue);
default:
return $this->_logUsage("{$sMatch} : Invalid question type : {$oQuestion->type} in {$this->sDebugWhere}");
}
break;


And, add this private function in GetstatInSurvey.php too:

/**
* Get the sum for a numeric question type
* @param : $sCode : question title
*/
private function getSumNumeric($sColumn,$sType="sumnum")
{
$aSumNumeric=array(); // Go to cache ?
if(isset($aSumNumeric[$sColumn]))
return $aSumNumeric[$sColumn];
$sQuotedColumn=Yii::app()->db->quoteColumnName($sColumn);
$iTotal=$this->getCountNumeric($sColumn);
$oCriteria = new CDbCriteria;
$oCriteria->select="SUM({$sQuotedColumn})";
$oCriteria->condition="submitdate IS NOT NULL";
$oCriteria->addCondition("concat('',{$sQuotedColumn} * 1) = {$sQuotedColumn}");
$iSum = Yii::app()->db->getCommandBuilder()->createFindCommand(SurveyDynamic::model($this->iSurveyId)->getTableSchema(),$oCriteria)->queryScalar();

if($iSum > 0){
$aSumNumeric[$sColumn]=round($iSum);
} else {
$aSumNumeric[$sColumn]="";
}
return $aSumNumeric[$sColumn];
}

It work on a V6.5.4 limesurveyVersion

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose