- Posts: 10
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
5 years 6 months ago - 5 years 6 months ago #174964
by iuriem
List the Array type question subquestions with some Assessment values was created 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.
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
- Online
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
5 years 6 months ago - 5 years 6 months ago #174968
by DenisChenu
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.
Replied by DenisChenu on topic List the Array type question subquestions with some Assessment values
Yes it's possible :
use countifop and that.Qcode.NAOK
Something like
{sum(countifop("A5",that.qcode.NAOK),countifop("A6",that.qcode.NAOK))}
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #174973
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
Thank you! So, if my array type question is named 'schemas', the equation will be:
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.
BTW, I am curious to learn something new, but realy I need to list the subquestions text, not to count them.
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.
Attachments:
The topic has been locked.
- DenisChenu
- Online
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
5 years 6 months ago #174974
by DenisChenu
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.
Replied by DenisChenu on topic List the Array type question subquestions with some Assessment values
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.
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #174977
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
Attachments:
The topic has been locked.
- iuriem
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #174979
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
Attachments:
The topic has been locked.
- DenisChenu
- Online
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
5 years 6 months ago #174981
by DenisChenu
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.
Replied by DenisChenu on topic List the Array type question subquestions with some Assessment values
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 )
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #174982
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
I already tested without 'test=', not working.
The topic has been locked.
- DenisChenu
- Online
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
5 years 6 months ago #174987
by DenisChenu
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.
Replied by DenisChenu on topic List the Array type question subquestions with some Assessment values
Oups … countif , not countifop …
{sum(countif("A5",that.schemas.NAOK),countif("A6",that.schemas.NAOK))}
{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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #175001
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
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.
I will ask a new question.
The topic has been locked.
- DenisChenu
- Online
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
5 years 6 months ago - 5 years 6 months ago #175004
by DenisChenu
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.
Replied by DenisChenu on topic List the Array type question subquestions with some Assessment values
For your need : you can not use self …
Then : something like
You can't use implode sirectly here …
You can use list
but only `,` for separator …
Maybe with str_replace :
If you have a comma in one question : it broke …
We really need a implodeif … it's not the 1st time i need it …
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) )}
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>
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
5 years 6 months ago #175007
by iuriem
Replied by iuriem on topic List the Array type question subquestions with some Assessment values
Thank you very much!
Yes, a 'implodeif' can help here.
Yes, a 'implodeif' can help here.
The topic has been locked.