- Posts: 12
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Division
- KimBracknell
- Topic Author
- Offline
- New Member
Less
More
4 years 9 months ago #186029
by KimBracknell
Division was created by KimBracknell
Hi all,
I have a field into which recipients type a number.
This number must be evenly divisible by 30 with 0 (zero) remainder.
How do I create an equation that ensures this happens?
Many thx,
Kim.
I have a field into which recipients type a number.
This number must be evenly divisible by 30 with 0 (zero) remainder.
How do I create an equation that ensures this happens?
Many thx,
Kim.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 9 months ago #186033
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Division
So you need to test if input of respondent x divided by 30 is without fraction
floor(x/y)==(x/y)
if floor(Inputvariable/30)==(Inputvariabe/30) is TRUE the input can be divided by 30 without a rest.
floor(x/y)==(x/y)
if floor(Inputvariable/30)==(Inputvariabe/30) is TRUE the input can be divided by 30 without a rest.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12922
- Thank you received: 3977
4 years 9 months ago #186040
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Division
Just to add:
This is the so called "modulo" function (usually A % B ) which gives you the remainder of a division.
It is not implemented in LimeSurvey so far, but in the manual you find it.
manual.limesurvey.org/Expression_Manager#Implemented_Functions
[hr]
Joffm
This is the so called "modulo" function (usually A % B ) which gives you the remainder of a division.
It is not implemented in LimeSurvey so far, but in the manual you find it.
manual.limesurvey.org/Expression_Manager#Implemented_Functions
[hr]
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- KimBracknell
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
4 years 9 months ago #186066
by KimBracknell
Replied by KimBracknell on topic Division
Thx Joffm and Jelo,
I can see why this would work but I cannot get the validation to work - see error attached.
Where/how do I enter this form Q15?
Formula is floor(Q15/20)==(Q15/30)
Thx again,
Kim.
I can see why this would work but I cannot get the validation to work - see error attached.
Where/how do I enter this form Q15?
Formula is floor(Q15/20)==(Q15/30)
Thx again,
Kim.
Attachments:
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 9 months ago - 4 years 9 months ago #186067
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Division
This is no RegEx validation. Just a validation based on ExpressionScript(ExpressionManager). For further questions please attach a LSS-export of the relevant parts.
Look under the Logic section for question/subquestion validation.
Look under the Logic section for question/subquestion validation.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Last edit: 4 years 9 months ago by jelo.
The topic has been locked.
- KimBracknell
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 9 months ago #186075
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Division
jelo wrote: For further questions please attach a LSS-export of the relevant parts.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12922
- Thank you received: 3977
4 years 9 months ago - 4 years 9 months ago #186094
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Division
Hi,
manual.limesurvey.org/Question_type_-_Nu...28em_validation_q.29
and study the demo surveys in the demo installation which you find under "Resources / Demo".
There is a survey called "Demo of em_validatin_sq".
And the first question in this survey is ""Enter an even number", that is "Enter a number that is divisible by 2 without remainder". So exactly the same as your "Enter a number that is divisible by 30 without remainder"
The ID of question with code Q1 is 2721.
But you do not need it.
Here you use the question code (Q15)
Your formula is fine (except of the typo). You only have to enter it in the right place, the question validation equation in "Edit / Logic".
Joffm
Please readWhere/how do I enter this form Q15?
Formula is floor(Q15/20)==(Q15/30)
manual.limesurvey.org/Question_type_-_Nu...28em_validation_q.29
and study the demo surveys in the demo installation which you find under "Resources / Demo".
There is a survey called "Demo of em_validatin_sq".
And the first question in this survey is ""Enter an even number", that is "Enter a number that is divisible by 2 without remainder". So exactly the same as your "Enter a number that is divisible by 30 without remainder"
HereHow do I get the question ID?
The ID of question with code Q1 is 2721.
But you do not need it.
Here you use the question code (Q15)
Your formula is fine (except of the typo). You only have to enter it in the right place, the question validation equation in "Edit / Logic".
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 9 months ago by Joffm.
The topic has been locked.
- KimBracknell
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
4 years 9 months ago #186111
by KimBracknell
Replied by KimBracknell on topic Division
Thx Joffm,
Getting close... see attached PDF where I have added a question to the demo survey and included the validation - this works! Yay! However, if I add a question to my own survey in the same fashion the error does not show up when I enter a number not divisible by 30?? What am I missing. Do I need to configure my survey with some particular details to get this to work?
Thx again,
Kim.
Getting close... see attached PDF where I have added a question to the demo survey and included the validation - this works! Yay! However, if I add a question to my own survey in the same fashion the error does not show up when I enter a number not divisible by 30?? What am I missing. Do I need to configure my survey with some particular details to get this to work?
Thx again,
Kim.
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12922
- Thank you received: 3977
4 years 9 months ago #186113
by Joffm
And as Jelo said:
Instead of attaching your pdfs, it's always recommended to send a sample survey with only the important questions as *.lss
Okay:
With these settings:
question validation equation: floor(self/30)==self/30
question validation tip: {if(floor(self/30)!=(self/30),"The number you entered is not a multiple of 30","That's fine")}
Instead of "self" you can use the question code as well.
I get:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Division
Obviously not.survey in the same fashion the error does not show up
And as Jelo said:
Instead of attaching your pdfs, it's always recommended to send a sample survey with only the important questions as *.lss
Okay:
With these settings:
question validation equation: floor(self/30)==self/30
question validation tip: {if(floor(self/30)!=(self/30),"The number you entered is not a multiple of 30","That's fine")}
Instead of "self" you can use the question code as well.
I get:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.