Welcome to the LimeSurvey Community Forum

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

Struggling with statCount

  • tammo
  • tammo's Avatar Topic Author
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 5 months ago #223812 by tammo
Struggling with statCount was created by tammo
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.2.10
Own server or LimeSurvey hosting: OWN
Theme: Custom (based on Vanilla)

==================
I am struggling with statCount, I hope anyone can help me.
I have made an example here:  research.respondage.com/index.php/942944?newtest=Y&lang=en

and in the attachment is the same survey. I just seem to be unable to get some functions working, although I have studied the manual at:
www.limesurvey.org/manual/StatFunctions
and
www.limesurvey.org/manual/ExpressionFixedDbVar

Any help is welcome!

Tammo

PS: the plugins "statFunctions" and  expressionFixedDbVar  have been switched "ON"
 


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
3 years 5 months ago #223828 by jelo
Replied by jelo on topic Struggling with statCount
The basic counting seems to work. Q03 works clean.
I'm a bit overwhelmed by the testsurvey and all the examples in Q01.

Let's take one example from the manual.
{statCountIf("lastepage", 1, 0)}
This looks wrong. lastepage as Questioncode?

You used:
statCountIf("LASTPAGE", 1)
Both result in an error message (Invalid question code).

What works:
statCountIf("lastpage", 1, 0)
statCount("id")

Looks to me some mistypes at the moment. But I haven't checked more things.
I have used LS 5.2.9 for testing.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 5 months ago #223837 by DenisChenu
Replied by DenisChenu on topic Struggling with statCount
- «statCountIf(self.sgqa,"") = 2 (Hoping to see: number of empty answers, but this answer is the total answers to this question:  Only completed responses are counted.)» no way currently to count seen but not answered response. Must report as a feature (Reason : "" == null == false)
- «statCountIf(self.sgqa,NA) = (Hoping to see: number of empty answers) :» No way, and surely not like this
- «statCount(Q00.sgqa, submitted=true) = (Hoping to see: number of answers to Q00 from completed surveys) » [, submitted=true] mean an optionnal parameter, default to true. NEVER use  submitted=true because you set variable submitted to true (for expression manager), and true is a var name too : error for expression manager :return "" (empty string) Then  statCount(Q00.sgqa, submitted=true) == statCount(Q00.sgqa)
- «statCount(Q00.sgqa, submitted==true)» error for expression manager :return "" (empty string)
- statCount(Q00.sgqa, submitted=false) error for expression manager :return "" (empty string)
- statCount(Q00.sgqa, submitted==false) error for expression manager :return "" (empty string)
- statCountIf(Q00.sgqa, submitted=true) error for expression manager :return "" (empty string)
- statCountIf(Q00.sgqa, submitted==true) error for expression manager :return "" (empty string)
- statCountIf(Q00.sgqa, submitted=false) error for expression manager :return "" (empty string)
- statCountIf(Q00.sgqa, submitted==false) error for expression manager :return "" (empty string)
- statCount('SID') : SID didn't exist in database, statCount('id') do the job
-  statCount("SID") : SID didn't exist in database, statCount('id') do the job
- statCount('942944') : 942944 didn't exist in database, statCount('id') do the job WHY you think put surey id can return something ?
- statCount("942944") = (Hoping to see: number completed responses to this survey) previous
- statCount(942944) = (Hoping to see: number completed responses to this survey) previous

Then :
1. true is an invalid variable name : this break and send "" : it's a expression manager gloab issue, not related to statCount : use 1 or 1 == 1 etc …
2. false is an invalid variable name : this break and send "" : it's a expression manager gloab issue, not related to statCount : use 0 or 1 == 0 etc …
2. Usage of SID, 1234 etc ¿ are never documented, because this don't exist in database. It's teh same than use "ANYTHING' for DB column.
- statCountIf("LASTPAGE", 1) : fix by statCountIf("lastpage", 1)
- statCountIf("STARTLANGUAGE", "en") : fix by statCountIf("startlanguage", 1)
- statCount("COMPLETED") : fix by statCount("submitdate") , completed don't really exist.
- statCount("COMPLETED", true) : fix by statCount("submitdate", 1) , but same with statCount("submitdate")
- statCount("COMPLETED", false) : do not exist way tpo count whole OR completed : fix by {statCount("submitdate", 0) - statCount("submitdate", 1)}
- statCount("COMPLETED", all) : fix by statCount("submitdate", 0)Finally : there are no link between the 2 plugin. except you can use one plugin in another (to bet tested)

For example : «There are {statCountIf("startlanguage", STARTLANGUAGE)} particpa,nt started with the same language than yours ({STARTLANGUAGE})»

Hope is more clear.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 5 months ago - 3 years 5 months ago #223838 by DenisChenu
Replied by DenisChenu on topic Struggling with statCount
It's strange : i think we must see submitted and true in red in expression manager for «{submitted ==  true}»

But we see only true … must check with other var name maybe …

 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 3 years 5 months ago by DenisChenu.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose