# array text value based dropdown list

2 months 1 day ago #203348 by brais24
Hi people, Im new here.

I have a doubt with Limesurvey, i have a dropdown list question called P1 that have for example 3 options, "A1","A2" and "A3", and the next question is an array text value called P2 that accepts numbers only, I want that, if you select A1, for example, on the array text, in total, you just be able to put as maximum 1, wich is the value of the dropdown list.

Is there any way to do it? Ive search by the forums and dont find nothing related to this.

I try with this on equation validation question, but dont work if(P1 == "A1",sum(self.NAOK) == 1,sum(self.NAOK) == 2)

On this example I try to do, if P1 is = to A1, the maximum value gonna be 1, else, gonna be 2, but dont works.

Thanks for the help.

LimeSurvey Partners
2 months 1 day ago #203349 by Joffm
Hi,
though you did not mention the version you are using nor show us exactly where you entered the validation equation,

here is what you get when you enter your (correct) equation correctly.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
##### Attachments:

2 months 1 day ago #203350 by brais24
Ok, thank you, that works, my version is a little bit old 2.72

Now, in the same case, the P1 is the number of workers , and the 3 options is

A1 = between 1 and 2
A2 = between 10 and 20
A3 = between 30 and 50

How can I do this? I try with multiple if, but dont work.

Thanks for the help, really.

2 months 1 day ago #203351 by Joffm
The same, you only have to compare that the "sum is greater than x AND sum is smaller than y".

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

2 months 1 day ago #203352 by brais24
But here we need to put a minimal and a maximum number for the same option if i dont missunderstand

2 months 1 day ago #203353 by brais24
Somethink like this?

if(P1 == "A1",sum(self.NAOK) <= 1,if(P1 == "A1",sum(self.NAOK) <= 2))

2 months 1 day ago #203354 by Joffm
Just translate my phrase.
You saw the capitalized AND?
Of course you may use "greater and equal", "smaller and equal" as well.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless