Welcome to the LimeSurvey Community Forum

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

"Only numbers" equation for two answer options out of 4

  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217127 by yg_zuffetti
Hi everyone, I would need some help from you guys to figure out an equation for an Array (Text) question that has 5 answer options (on the x-axis) and I need two of these to be set up for only numbers when users fill in their answers. I have uploaded a screenshot of the question and AO02-AO03 are the numbers onl. I would really appreciate your help, Thank you!!! 
 
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #217129 by Joffm
Hi,

there are some options:
1. with javascript:
[url] forums.limesurvey.org/forum/installation...rray-question#204171 [/url]
You only have to copy and adapt the code for the second column to have it for the third column, too. 

2. question validation equation
(is_empty(self.sq_SQ001_AO02) or is_numeric(self.sq_SQ001_AO02)) and (is_empty(self.sq_SQ001_AO03) or is_numeric(self.sq_SQ001_AO03)) and 
(is_empty(self.sq_SQ002_AO02) or is_numeric(self.sq_SQ002_AO02)) and (is_empty(self.sq_SQ002_AO03) or is_numeric(self.sq_SQ002_AO03)) and 
(is_empty(self.sq_SQ003_AO02) or is_numeric(self.sq_SQ003_AO02)) and (is_empty(self.sq_SQ003_AO03) or is_numeric(self.sq_SQ003_AO03)) and 
...

And an explaining validation tip.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217132 by yg_zuffetti
Dearest Joffm, thank you for your prompt reply. As I am still very new with this, I am not sure if I have this figurest out. So as for the subquestion validation equation I have to write the equation 14 times for every column I have? like so (is_empty(self.sq_SQ014_AO03) or is_numeric(self.sq_SQ014_AO03)).

As for my validation tip, what should I insert? thank you dearly for your precious help! have a good day!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #217135 by Joffm
Hi,

2. question validation equation

not "subquestion validation"

 I have to write the equation 14 times for every column I have

Yes, for every ROW.
This is what you want:
(Either row1, column 2 is empty OR it is numeric) AND (Either row1, column 3 is empty OR it is numeric) AND (Either row2, column 1 is empty OR it is numeric) AND ...
As you might see, the "is_empty" part avoids an error message if the cell is still empty (= not numeric).

As I showed it for 3 rows (subquestions)

And the tip? Up to you.
What do you want to tell your repondents?
"Please, enter only numeric values in column 2 and column 3". Or whatever you like.
And of course you can customize it with some IF-statements.





In my opinion you'd better use the javascript solution.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #217144 by DenisChenu

In my opinion you'd better use the javascript solution.
 
Except if you need real validated value.
javascript must be workaround, add option. But it's not a way to control and validate value entered by user.

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.
  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217180 by yg_zuffetti
Thank you Joffm, I am not familiar with Javascript so I might go with the equation you gave me however I am not sure if I it's working. In addition, I was wondering how to add another row to a subquestion. When my user selects and answer in the previous question, a subquestion comes up and I have only one row. Can I add more? Thank you!!
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #217183 by Joffm
Now I am really confused.
In your first post there were 14 subquestions, now it is only 1.
Without seeing your survey I am not able to answer.
So attach the lss export of the survey (reduced to the relevant questions)

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217215 by yg_zuffetti
My apologies Joffm, I will question it differently. I have three issues.

1. I need to write an equation that will allow me to set the rule of allowing only numbers for column 2 and column 3 (where we ask users for ha). In addition, is it possible to add another row for this same subquestion when its selected from the previous one? 

 

2. Furthermore, in the case of this other question, I need to write an equation that will allow me to have only numbers in the comment once the subquestion is selected. In the logic section it will allow me to select "Number only for other" 

 


Thank you for the patience Joffm and for the help.
Best,
Yasmeen
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago - 2 years 10 months ago #217217 by Joffm
Again: Send the lss export!

1. Because there are different ways to display the rows of the array depending on the multiple question, I cannot answer this without knowing what you did.
To give you a hint 
Array subquestions:


2. Why do you use a multiple with comment question here?
Isn't it sufficient to use a "multiple numerical input"?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 10 months ago by Joffm.
The topic has been locked.
  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217279 by yg_zuffetti
Dear Joffm,

First of all thank you for taking the time to help me out with this!!!

1. I was able to sort this equation out by sorting out how I had previously displayed the rows, so thank you!! Your feedback was great! Would you know if there is a way to add a row for example to "marine" if this ecosystem is selected? 

 


2. Our user has to choose the area of the ongoing project and for such reason we had to select a multiple choce with comment. Is there an equation to allow for numeric values only when answering this please?? 


Thank you!!! Have a great day!! 

Best, Yasmeen
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #217289 by Joffm
You have to validate.
Like
((Q1_SQ001=="Y" and is_numeric(Q1_SQ001comment)) or is_empty(Q1_SQ001comment)) and ((Q1_SQ002=="Y" and is_numeric(Q1_SQ002comment)) or is_empty(Q1_SQ002comment)) ...

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • yg_zuffetti
  • yg_zuffetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #217386 by yg_zuffetti
Thank you Joffm, the equation worked! If I want to specify only integers should I replace it to numerics? Thanks and have a great day!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose