Welcome to the LimeSurvey Community Forum

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

Equals sum value over 2 separate questions?

  • AmirahR247
  • AmirahR247's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago #258574 by AmirahR247
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi there,

Is there a way to have a maximum sum value over 2 separate questions?

The first question is a numerical input & asks the percentage of main milk brand usage (Milk 1), the next question is a multiple numerical input and asks the percentage of other milk brand usage (Milk 2, Milk 3 etc.).
How can I get the total usage percentage to not exceed 100%? So if in Q1 Milk 1 = 60%, in Q2 Milk 2 + Milk 3 should be forced to sum to 40% (Q2 should be 100%-Q1)

Thanks

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #258575 by DenisChenu
Replied by DenisChenu on topic Equals sum value over 2 separate questions?

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.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago - 1 month 1 week ago #258581 by tpartner
Replied by tpartner on topic Equals sum value over 2 separate questions?
If Q2 is a multi-numeric, I think its validation equation should be:

Code:
sum(Q1, self) <= 100

Or:

Code:
sum(Q1, that.Q2) <= 100

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 1 month 1 week ago by tpartner.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #258585 by holch
Why not putting all milk brands into 1 multiple numerical question? For sure would be a lot more userfriendly for the respondent to fill and you can show how much they have already distributed from the 100%.

1. Main milk brand
2. Second brand
3. Third brand...

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

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #258587 by DenisChenu
Replied by DenisChenu on topic Equals sum value over 2 separate questions?

If Q2 is a multi-numeric, I think its validation equation should be:

 
Yes ! You're right !
 

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.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose