Welcome to the LimeSurvey Community Forum

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

Equation type question

  • JSamarov
  • JSamarov's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #232714 by JSamarov
Equation type question was created by JSamarov
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud
Version 5.4.3
==================
Hi All 

I'm trying to use   to assign value 1 if all subquestions in an array have the same answers "A1" (i.e. "None").
I've tried everything I could think of with no luck :(
Please assist. Example attached.

if(BA2_SQ001.NAOK == "A1" and BA2_SQ002.NAOK == "A1" and BA2_SQ003.NAOK == "A1" and BA2_SQ004.NAOK == "A1" and BA2_SQ005.NAOK == "A1" and BA2_SQ006.NAOK == "A1" and BA2_SQ007.NAOK == "A1" and BA2_SQ008.NAOK == "A1" and BA2_SQ009.NAOK == "A1" and BA2_SQ010.NAOK == "A1", 1, 0)

Many thanks in advance!!
Jay

 

File Attachment:

File Name: limesurvey...5423.lss
File Size:61 KB

 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 months ago - 2 years 3 months ago #232722 by Joffm
Replied by Joffm on topic Equation type question
Hi,
that's because of your arraqy filter
E.g. if BA2_SQ003 isn't displayed and BA2_SQ003.NAOK is not defined, especially it is not equal "A1".

You should use the function "countifop".
like
{if(countifop(">","A1" ,BA2_SQ001.NAOK ,BA2_SQ002.NAOK ,BA2_SQ003.NAOK ,BA2_SQ004.NAOK ,BA2_SQ005.NAOK ,BA2_SQ006.NAOK ,BA2_SQ007.NAOK ,BA2_SQ008.NAOK ,BA2_SQ009.NAOK ,BA2_SQ010.NAOK)==0,1,0)}
Meaning: If no one of the items was rated greater 1 the result is "1", otherwise the result is "0".

If you use a "better" coding of the subquestions to distinguish between these 10 (SQ001, SQ002, ...) and the rest (RQ001, RQ002,...) and use numerical codes in your array (1,2,3,4,5)
you can shorten this to
{if(countifop(">","1",that.BA2.sq_S.NAOK)==0,1,0)}

I was a bit confused about the question text of BA2.
There are more brands displayed than I selected as "aware of" in BA1.
I never said that I am aware of "Healthgarde".

 

File Attachment:

File Name: limesurvey... (1).lss
File Size:59 KB


Joffm

P.S.
Seeing your survey again I think there is something missing in your sample.
There is an exclusive option SQ019 in BA1 but no subquestion with this code.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 3 months ago by Joffm. Reason: file attached
The following user(s) said Thank You: JSamarov

Please Log in to join the conversation.

  • JSamarov
  • JSamarov's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 3 months ago #232734 by JSamarov
Replied by JSamarov on topic Equation type question
Joffm, you are a start as usual! Thank you very much. I'll be using this technique going forward.

P.S. apologies about the confusion. I needed to shorten the survey to show the example. And I accidentally didn't remove some of the parts (i.e. the exclusive option SQ019, etc).

Thank you again!!

Best,
Jay

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose