Welcome to the LimeSurvey Community Forum

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

Distribute n points over several selections

  • umfundi
  • umfundi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago - 7 years 2 months ago #148289 by umfundi
I have a question in which I want to distribute 10 points over 4 categories.

So the question is set up as an Array (10 point choice) with 4 option questions. each option has 11 radio selections ( 1-10 and no answer )

i am trying to get a total (sum) for the 4 responses and ensure that they all come up to 10.

none of my validation equations seem to work!

ive tried (sum(q1_SQ001.value, q1_SQ002.value ,q1_SQ003.value, q1_SQ04.value) = 10)

Aaargh help please.

I really am battling to get to grips with the formulation of the equations, is there a good explanation of the .'s and _'s, braced and brackets terms somewhere?
Last edit: 7 years 2 months ago by umfundi.
The following user(s) said Thank You: SoumenKamley
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148299 by tpartner
Replied by tpartner on topic Distribute n points over several selections
I see a couple of problems...

1) You are using the wrong operator - manual.limesurvey.org/Expression_Manager#Operators
2) You don't need the .value extension unless you are trying to access the assessment value - manual.limesurvey.org/Expression_Manager#Access_to_Variables

Either of these should do the trick:

Code:
{sum(that.Q1) == 10}
Code:
{sum(Q1_SQ001, Q1_SQ002 , Q1_SQ003, Q1_SQ004.value) == 10}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • umfundi
  • umfundi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #148307 by umfundi
Replied by umfundi on topic Distribute n points over several selections
Massive step closer. Thanks TP.
The topic has been locked.
  • umfundi
  • umfundi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #148343 by umfundi
Replied by umfundi on topic Distribute n points over several selections
Just had to wrap it differently as

(sum(that.Q1) == 10)


if i wrapped the outer in curlys it stopped validating.

Odd but I'm not questioning it at the moment.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148354 by holch
relevance equations = no curly brackets
normal equation questions and anywhere else = curly brackets

Weird why in the relevance equations we can not use curly brackets but in the other situations have to. saves a few milliseconds writing the code, but lacks of consistence.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • umfundi
  • umfundi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 months ago #148358 by umfundi
Replied by umfundi on topic Distribute n points over several selections
Problem is now sorted. Thanks for the help. I have a working survey!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148360 by DenisChenu
Replied by DenisChenu on topic Distribute n points over several selections

holch wrote: Weird why in the relevance equations we can not use curly brackets but in the other situations have to. saves a few milliseconds writing the code, but lacks of consistence.

In relevance : we wait for a value: then a "evaluation". On other oart : by default it's text , we can force EM with bracket.

About some better GUI : added it in advanced settings


You're right : same in relevance seems OK. If you find another place too :)

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148361 by DenisChenu
Replied by DenisChenu on topic Distribute n points over several selections
Added for relevance

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.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148365 by holch

In relevance : we wait for a value: then a "evaluation". On other oart : by default it's text , we can force EM with bracket.

I understand where it comes from. In some parts there can only be an equation, so then there is actually no need to put {}, but as I said, it is confusing at the beginning, because you "learned" that equations need curly brackets.

Looks good your GUI solution.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose