List the Array type question subquestions with some Assessment values

More
2 weeks 2 days ago - 2 weeks 2 days ago #174964 by iuriem
iuriem created the topic: List the Array type question subquestions with some Assessment values
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: 2 weeks 2 days ago by iuriem.

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago - 2 weeks 2 days ago #174968 by DenisChenu
DenisChenu replied the 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))}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 2 weeks 2 days ago by DenisChenu. Reason: manual link

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174973 by iuriem
iuriem replied the 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:
{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.
{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:

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174974 by DenisChenu
DenisChenu replied the 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.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174977 by iuriem
iuriem replied the topic: List the Array type question subquestions with some Assessment values
You mean this?

Attachments:

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174979 by iuriem
iuriem replied the topic: List the Array type question subquestions with some Assessment values
Attachments:

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174981 by DenisChenu
DenisChenu replied the 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 )

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174982 by iuriem
iuriem replied the topic: List the Array type question subquestions with some Assessment values
I already tested without 'test=', not working.

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #174987 by DenisChenu
DenisChenu replied the 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))}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: iuriem

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #175001 by iuriem
iuriem replied the 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.

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago - 2 weeks 2 days ago #175004 by DenisChenu
DenisChenu replied the topic: List the Array type question subquestions with some Assessment values
For your need : you can not use self …

Then : something like
{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
{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 :
<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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 2 weeks 2 days ago by DenisChenu.
The following user(s) said Thank You: iuriem

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #175007 by iuriem
iuriem replied the topic: List the Array type question subquestions with some Assessment values
Thank you very much!

Yes, a 'implodeif' can help here.

Please Log in or Create an account to join the conversation.

More
2 weeks 1 day ago #175021 by DenisChenu
DenisChenu replied the topic: List the Array type question subquestions with some Assessment values

iuriem wrote: Thank you very much!

Yes, a 'implodeif' can help here.

Time to make a feature request ;) : www.limesurvey.org/community/feature-requests

(but i think best feature is allow extend/add function in Expression Manager)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 weeks 1 day ago #175035 by jelo
jelo replied the topic: List the Array type question subquestions with some Assessment values

DenisChenu wrote: (but i think best feature is allow extend/add function in Expression Manager)

bugs.limesurvey.org/view.php?id=14130

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: DenisChenu

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!