x

Main chapters

  1. LimeSurvey Cloud vs LimeSurvey CE
  2. LimeSurvey Cloud - Quick start guide
  3. LimeSurvey CE - Installation
  4. How to design a good survey (Guide)
  5. Getting started
  6. LimeSurvey configuration
  7. Introduction - Surveys
  8. View survey settings
  9. View survey menu
  10. View survey structure
  11. Introduction - Questions
  12. Introduction - Question Groups
  13. Introduction - Surveys - Management
  14. Survey toolbar options
  15. Multilingual survey
  16. Quick start guide - ExpressionScript
  17. Advanced features
  18. General FAQ
  19. Troubleshooting
  20. Workarounds
  21. License
  22. Version change log
  23. Plugins - Advanced
 Actions

StatFunctions: Difference between revisions

From LimeSurvey Manual

DenisChenu (talk | contribs)
m you can use <, >, >=, <=, <> operator
Tammo (talk | contribs)
m Some text changes for better readability
Line 1: Line 1:
{{FeatureStarting|4.1.0}}  
{{FeatureStarting|4.1.0}}  


Functions for expression manager to count some statistics data :
Functions for the expression manager to count some statistics data :


* statCount(QuestionCode.sgqa[, submitted = true]) : count the answered question of QuestionCode already submitted. You can count the submitted survey with statCount('sid') for example.
* statCount(QuestionCode.sgqa[, submitted = true]) : count the number of already submitted answered questions by QuestionCode. You can count the number of submitted (= completed) surveys with statCount('sid') for example.
* statCountIf(QuestionCode.sgqa, value[, submitted = true]) : count the response where answer to question QuestionCode are value. The comparaison use [https://www.yiiframework.com/doc/api/1.1/CDbCriteria#compare-detail Yii compare], you can use <, >, >=, <=, <> operator at start of your value.
* statCountIf(QuestionCode.sgqa, value[, submitted = true]) : count the number of responses where answer to question QuestionCode equals value. The comparison uses [https://www.yiiframework.com/doc/api/1.1/CDbCriteria#compare-detail Yii compare], you can use <, >, >=, <=, <> operator at start of your value.


You can find an usage of this 2 functions in [https://github.com/LimeSurvey/LimeSurvey/blob/master/tests/data/surveys/survey_archive_statCountFunctionsTest.lsa survey_archive_statCountFunctionsTest] inside test directory.
You can find an example of the usage of these 2 functions in: [https://github.com/LimeSurvey/LimeSurvey/blob/master/tests/data/surveys/survey_archive_statCountFunctionsTest.lsa survey_archive_statCountFunctionsTest] inside the test directory.


[[File:StatFunctionsSample.png]]
[[File:StatFunctionsSample.png]]


This plugin use [[ExpressionManagerStart]] plugin and create two functions. This 2 functions don't have javascript part, then the check is done only when move in survey.
This plugin uses the [[ExpressionManagerStart]] plugin and it creates two functions. These 2 functions don't use javascript, so the check is done only when the respondent moves ahead in the survey.


{{Alert|Before using these functions : the plugin must be activated in [[Plugin_manager#General|Plugin Manager]].}}
{{Alert|Before using these functions : the plugin must be activated in [[Plugin_manager#General|Plugin Manager]].}}


[[Category:Plugins]][[Category:Core Plugins]]
[[Category:Plugins]][[Category:Core Plugins]]

Revision as of 17:39, 17 December 2021

 Hint: This features is available starting in version 4.1.0


Functions for the expression manager to count some statistics data :

  • statCount(QuestionCode.sgqa[, submitted = true]) : count the number of already submitted answered questions by QuestionCode. You can count the number of submitted (= completed) surveys with statCount('sid') for example.
  • statCountIf(QuestionCode.sgqa, value[, submitted = true]) : count the number of responses where answer to question QuestionCode equals value. The comparison uses Yii compare, you can use <, >, >=, <=, <> operator at start of your value.

You can find an example of the usage of these 2 functions in: survey_archive_statCountFunctionsTest inside the test directory.

This plugin uses the ExpressionManagerStart plugin and it creates two functions. These 2 functions don't use javascript, so the check is done only when the respondent moves ahead in the survey.

  Before using these functions : the plugin must be activated in Plugin Manager.