Welcome to the LimeSurvey Community Forum

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

List the Array type question subquestions with some Assessment values

  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago - 5 years 6 months ago #174964 by iuriem
Hi,

I have an Array type question with 114 subquestions and six answer options valued from 1 to 6 (A1-A6). I need to list at the End message subquestions for which the answer options valued with 5 or 6 were selected (A5 or A6). Is this possible în LimeSurvey? Any suggestions would be appreciated. Thank you!

I know how to use the if statement, but for 114 subquestions this will be a very long code/solution.

My current version is 3.14.8+180829.
Last edit: 5 years 6 months ago by iuriem.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #174968 by DenisChenu
Yes it's possible :
use countifop and that.Qcode.NAOK

Something like
{sum(countifop("A5",that.qcode.NAOK),countifop("A6",that.qcode.NAOK))}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 6 months ago by DenisChenu. Reason: manual link
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174973 by iuriem
Thank you! So, if my array type question is named 'schemas', the equation will be:
Code:
{sum(countifop("A5",that.schemas.NAOK),countifop("A6",that.schemas.NAOK))}

I added this equation to a equation type question, named 'test', right after the 'schemas' question, but it is not calculating anything, it just displays a 0, regardless of how many A5 or A6 answer options have been selected.
Code:
{test=sum(countifop("A5",that.schemas.NAOK),countifop("A6",that.schemas.NAOK))}

BTW, I am curious to learn something new, but realy I need to list the subquestions text, not to count them.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174974 by DenisChenu
I don't fix group [*] … sometimes lss …
please : send a screenshot of Survey Logic file

* : lsg file need for me to : create a survey with group language (currently unknow), import group.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174977 by iuriem
Attachments:
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174979 by iuriem
Attachments:
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174981 by DenisChenu
If you want test to be filled by the value, remove the test= before …

Directly add
{sum(countifop("A5",that.schemas.NAOK),countifop("A6",that.schemas.NAOK))} in question text (or in equation settings : manual.limesurvey.org/Question_type_-_Eq...ation_.28equation.29 )

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #174982 by iuriem
I already tested without 'test=', not working.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #174987 by DenisChenu
Oups … countif , not countifop …

{sum(countif("A5",that.schemas.NAOK),countif("A6",that.schemas.NAOK))}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: iuriem
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #175001 by iuriem
Thank you! It's not exactly what I wanted to do, but you showed me something I did not know. :)

I will ask a new question.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #175004 by DenisChenu
For your need : you can not use self …

Then : something like
Code:
{if(shemas_i001.NAOK == "A5" or shemas_i001.NAOK == "A6",shemas_i001.question)}
{if(shemas_i002.NAOK == "A5" or shemas_i002.NAOK == "A6",shemas_i002.question)}{if(shemas_i124.NAOK == "A5" or shemas_i124.NAOK == "A6",shemas_i124.question)}

You can't use implode sirectly here …

You can use list
Code:
{list(
if(shemas_i001.NAOK == "A5" or shemas_i001.NAOK == "A6",shemas_i001.question),
if(shemas_i002.NAOK == "A5" or shemas_i002.NAOK == "A6",shemas_i002.question),if(shemas_i124.NAOK == "A5" or shemas_i124.NAOK == "A6",shemas_i124.question)
)}
but only `,` for separator …

Maybe with str_replace :
Code:
<ul><li>{str_replace(",","</li><li>",list(
if(shemas_i001.NAOK == "A5" or shemas_i001.NAOK == "A6",shemas_i001.question),
if(shemas_i002.NAOK == "A5" or shemas_i002.NAOK == "A6",shemas_i002.question),if(shemas_i124.NAOK == "A5" or shemas_i124.NAOK == "A6",shemas_i124.question)
))}</li></ul>
If you have a comma in one question : it broke …

We really need a implodeif … it's not the 1st time i need it …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 6 months ago by DenisChenu.
The following user(s) said Thank You: iuriem
The topic has been locked.
  • iuriem
  • iuriem's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #175007 by iuriem
Thank you very much!

Yes, a 'implodeif' can help here.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose