Welcome to the LimeSurvey Community Forum

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

not equal in group relevance equation

  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 5 months ago - 5 years 5 months ago #176903 by KompetenzZ
not equal in group relevance equation was created by KompetenzZ
Hi community,

I tried to set a relevance equation for a question group, the question group should only be displayed when:
Code:
! is_empty(Q1.NAOK == 9) OR ! is_empty(Q1.NAOK == 3) AND (Q2 != "waidhofen an der ybbs" OR Q2 != "allhartsberg")

Can it be that the "!=" in the equation makes troubles? Q1 is a radio (list) question and Q2 is a short free text question. When I check Q1_3 and write "waidhofen an der ybbs" or "allhartsberg", the question group that should be hidden is still displayed.

When I write instead of unequal ("!="), the equal sign ("==") it works. But I would need the unequal sign.
I've been tinkering with it for a long time, but I just cannot find the mistake.

A sample survey (.lss) with this is attached.

LS Version: 3.14


File Attachment:

File Name: limesurvey...4415.lss
File Size:20 KB

Cheers kompetenzz
Last edit: 5 years 5 months ago by KompetenzZ.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176907 by tpartner
Replied by tpartner on topic not equal in group relevance equation
There us no reason to use is_empty() when trying to determine the value of a list-radio question. It should be Q1.NAOK == 'x'.

Shouldn't that be an AND between the 'does not equal' statements?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago - 5 years 5 months ago #176925 by Joffm
Replied by Joffm on topic not equal in group relevance equation
Hi,
1. as Tony said
"Q1==9" gives a result of true or false (1 or 0). So it is never empty.


2. (Q2 != "waidhofen an der ybbs" OR Q2 != "allhartsberg")
Tony already mentioned it.
This way you will get everything, even "allhartsberg"; it is unequal to "waidhausen..."
Just to remind:
NOT ( A OR B ) == ( NOT A ) AND ( NOT B )
NOT ( A AND B ) == ( NOT A ) OR ( NOT B )

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 5 months ago by Joffm.
The topic has been locked.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 5 months ago #176928 by KompetenzZ
Replied by KompetenzZ on topic not equal in group relevance equation
As far as I understand it, compared to an equation with EQUAL (as mentioned in the first post) the NOT EQUAL makes it neccessary to change the logical operator between the != from OR to AND.
Yes the is_empty was also misplaced.
This is probably easy for most folks here, but for myself this would not have come to my mind. Thank you very much.
Just for information, this is the adapted equation:
Code:
Q1.NAOK == 9 OR Q1.NAOK == 3 AND (Q2 != "waidhofen an der ybbs" AND Q2 != "allhartsberg")

Cheers kompetenzz
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176930 by DenisChenu
Replied by DenisChenu on topic not equal in group relevance equation
Without brace it's unclear :
You want
Code:
(Q1.NAOK == 9 OR Q1.NAOK == 3) AND Q2.NAOK != "waidhofen an der ybbs" AND Q2.NAOK != "allhartsberg"
or
Code:
Q1.NAOK == 9 OR (Q1.NAOK == 3 AND Q2.NAOK != "waidhofen an der ybbs" AND Q2.NAOK != "allhartsberg")
or really
Code:
Q1.NAOK == 9 OR (Q1.NAOK == 3 AND Q2.NAOK != "waidhofen an der ybbs" AND Q2.NAOK != "allhartsberg")

And with the current script : there are a lack of trigger action when user select an option : sample : gitlab.com/SondagesPro/QuestionSettingsT...-autocomplete.js#L29

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 5 months ago #176935 by KompetenzZ
Replied by KompetenzZ on topic not equal in group relevance equation
I cannot find any difference between your second and third equation but yes these are those equations that I need, thank you for sharing you knowledge.

Regarding your last sentence: Is it that you mean that the script of the autocomplete question I asked www.limesurvey.org/forum/design-issues/1...uestion-on-same-page is not possible to implement?

Cheers kompetenzz
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176941 by DenisChenu
Replied by DenisChenu on topic not equal in group relevance equation
The script didn't trigger action when user select a value : you must add it manually.

In 3.X : autocomplete are devbridgeAutocomplete

Then maybe something like this
Code:
      $('#question'+qID+' input[type="text"]').autocomplete({
        source: province,
        onSelect: function (suggestion) {
          $('#question'+qID+' input[type="text"]').val(suggestion.data).trigger("keyup");
        }
      });

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 5 months ago #176949 by KompetenzZ
Replied by KompetenzZ on topic not equal in group relevance equation
Well I don't have experience with gitlab.com, I try to ask as few question as I can:

1. Do I have to add the limesurvey-autocomplete.js from gitlab.com/SondagesPro/QuestionSettingsT...-autocomplete.js#L29 at the end of my autocomplete question?

2. Do I have to add the limesurvey-autocomplete.css from gitlab.com/SondagesPro/QuestionSettingsT...vey-autocomplete.css to the end of custom.css in my theme?

3. Where do I have to add the path to the csv lists where the autocomplete entries are stored? I don't know, I tried to find something like:
var url = surveyRoot+"upload/themes/survey/extends_bootswatch/autocomplete_list.csv";

4. Where do I have to add the code for the trigger action of your previous post?


If it's less complicated instead of answering these questions, rather adapt the test survey (.lss).

File Attachment:

File Name: limesurvey...1-15.lss
File Size:20 KB

File Attachment:

File Name: extends1_b...1-15.zip
File Size:287 KB

Cheers kompetenzz
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176966 by DenisChenu
Replied by DenisChenu on topic not equal in group relevance equation
The pluugin is another way to do …

Where i need to trigger the event when user select something …

Then maube some code can inspire see www.limesurvey.org/fr/forum/design-issue...ance-equation#176941

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 5 months ago #177010 by KompetenzZ
Replied by KompetenzZ on topic not equal in group relevance equation
Sorry, I don't have the experience to do that.

Cheers kompetenzz
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose