Welcome to the LimeSurvey Community Forum

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

Expression Manager shenanigans

  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #219407 by D.Strought
Expression Manager shenanigans was created by D.Strought
Hey there, first time on this forum will do my best to be precise.

I have a Matrix; if a user scores 03 or higher it counts as interest.
 

In addition I have a Multiplechoice item so users can pic a topic
 

Both are in their own consecutive questions groups.

The question group for Topic A has the following expression:​​​​​​( S1NB01_ESI01  != 'A01' and  S1NB01_ESI01  != 'A02') OR  S1NB02_SAI01  == 'Y'
All of this works fine.
My Problem:
I want the multiple choice item only to appear when users pick 01 or 02 in all subquestions of the Matrix.
For this I use the expression:
(S1NB01_ESI01 == 'A01' OR S1NB01_ESI01 == 'A02') AND (S1NB01_ESI02 == 'A01' OR S1NB01_ESI02 == 'A02') AND (S1NB01_ESI03 == 'A01' OR S1NB01_ESI03 == 'A02') AND (S1NB01_ESI04 == 'A01' OR S1NB01_ESI04 == 'A02')
The "appearing" only when needed part works fine but it destroys the "normal" selection through the Matrix.

Is it because the answers of the Multiple Choice item are not checkable unless its condition is met? Or is the issue something completely different?
How can I get this to work?

Thanks in advance.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #219410 by Joffm
Replied by Joffm on topic Expression Manager shenanigans
Hi,
first i am confused about this

The question group for Topic A has the following expression:​​​​​​(  S1NB01_ESI01   != 'A01' and   S1NB01_ESI01   != 'A02') OR   S1NB02_SAI01   == 'Y'

Which question group?
Sounds to me like: There is interest for Topic A, if either the selected value in the array is greater  "A02" OR it was selected in the multiple question.
And this - above - equation doesn't work 

Now what exactly is to happen in your survey?
If there is at least one topic rated "A03" or above, the multiple question is hidden and this topic is "of interest" The multiple question is hidden.
If there is no topic rated "A03" or above, the multiple question is shown.

To know which topic was of interest later in your survey you alwys have to use both questions.
I'd advice to set selected topics, in your multiple question by an equation. As you see I use numerical codes in the array.
Like 
{S1NB02_SAI01=if(S1NB01_ESI01>2,"Y","")}
{S1NB02_SAI02=if(S1NB01_ESI02>2,"Y","")}
...

So, if the multiple question is shown or not, you always store the topics of interest in this queston.

By the way:
If you'd use numerical codes (as I did in my example) for the answer option of the array, your relevance equation of the multiple question could be shortened to
countifop(">","2",that.S1NB01)==0

As your answer options seem to be more or less a scale you certainly want to compare the rating of the topics (mean, std.deviation, t-test, ANOVA,...). Here you need numerical values.

 Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: D.Strought
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 9 months ago #219414 by DenisChenu
Replied by DenisChenu on topic Expression Manager shenanigans
Not related to development, i move it.

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 following user(s) said Thank You: D.Strought
The topic has been locked.
  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago - 3 years 9 months ago #219418 by D.Strought
Replied by D.Strought on topic Expression Manager shenanigans
My apologies. Thanks for moving me the topic.
Last edit: 3 years 9 months ago by D.Strought.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 9 months ago #219419 by DenisChenu
Replied by DenisChenu on topic Expression Manager shenanigans
I don't move you, but the topic :)))

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.
  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #219427 by D.Strought
Replied by D.Strought on topic Expression Manager shenanigans
 
Hey Joffm,
thanks for the quick answer.
You assumed correctly about my intent and the resulting problem.

I use numerical codes in the array

 And I use numerical now as well, good advice. That definitely would have caused problems later on.

you always store the topics of interest in this queston

I was hoping for such an elegant and simple solution and I'd love to implement it.

I have to admit I cannot find a way to implement that code though.
Where can I preset the checkboxes with expression-code in a multiple-choice item?
All I can find is manually presetting the checkboxes as well as making the whole subquestion depend on it.
But that's not what we want :)

Maybe you or anyone else can help me out here once more.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #219434 by Joffm
Replied by Joffm on topic Expression Manager shenanigans
Well, you have to use equations to set the values.
Like
{Q1_SQ001=if(Q2_SQ003==4,"Y","")}
meaning: The subquestion SQ001 of the multiple question Q1 is set to "Y" (selected), if the subquestion SQ003 of question Q2 has the value 4.

Here a sample.
In QInterest you find all Topics of interest, either selected in Q1 or selected in Q2.
"Info" is just an Information.

 

File Attachment:

File Name: limesurvey...1685.lss
File Size:29 KB

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: D.Strought
The topic has been locked.
  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #219450 by D.Strought
Replied by D.Strought on topic Expression Manager shenanigans
Alright, that helped a lot. Thank you!
Spend the day picking the example apart and looking up the syntax and replicating the survey.

One last problem remains:
I can't get my question groups that hold the topic later on to match the status of the memory item.

I really hope it's just an error on my side. From everything, I read the multiple-choice can have "Y" and empty "" I just can't get that addressed.

I tried it in my and in your survey, I'll attach mine if you would like to have a look. 

File Attachment:

File Name: DStrought-...4861.lss
File Size:29 KB


Soweit aber schonmal vielen Dank für die Hilfe an diesem Beispiel have ich wohl mehr gelernt und gehadert als an allen in den Uni-Seminaren.
Habe erst später bemerkt, dass es auch in sehr aktives Deutsches Unter-Forum gibt, auf dem Sie auch aktiv sind :D
 
The topic has been locked.
  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #219524 by D.Strought
Replied by D.Strought on topic Expression Manager shenanigans
Hey Joffm,
any idea on my remaining issue or should I post it as a separate topic/question to the Forum?

I can't get my question groups that hold the topic later on to match the status of the memory item.

The topic has been locked.
  • D.Strought
  • D.Strought's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #219595 by D.Strought
Replied by D.Strought on topic Expression Manager shenanigans
Awesome. Everything I needed was in Joffm's example.
Took me a while to find all of the errors I made when I transferred his example to my setting but now everything works as intended. 
(The expression wasn't the problem
Code:
== "Y"
works just fine. I screwed up in the Q1 mixing up an item name )
Once again Thank you!

My (now working example Survey)

File Attachment:

File Name: limesurvey...4861.lss
File Size:30 KB


This topic can be locked now.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose