# Quota definition with a dynamic list: male female divers

When I need to define a quota based on a gender question (male/female/divers) - and "divers" should be randomized counted as male or female: What is the easiest way to do?

I created a list that results in the correct values (1 "for male" /2 for "female" / randomly 1 or 2 for "divers").

But it seems I can't define the quote based on the value that is in dis dynamic list.....

any ideas?

So that I understand correctly, you ask a single response question ...

Are you ...
1 Male
2 Female
3 Diver

And the quota question then needs to be allocated as follows ...
If Male, quota=1
If Female, quota=2
If Diver=quota is randomly allocated to a 1 or 2

Is that correct?

If so, you can create a gender quota variable and save the answer in there, and then operate the quota off the gender quota variable.

Here's the steps ...

1/ Go to the pass-in fields and create a variable called "QTGender" and set it to a whole number.

2/ Insert this Perl Script in to the footer of a question that is not skipped and appears after the gender question (which I assume is Q1).
```Begin Unverified Perl

if(VALUE("Q1")==1)
{
SETVALUE("QTGender",1);
}
elsif(VALUE("Q1")==2)
{
SETVALUE("QTGender",2);
}
elsif(VALUE("Q1")==3)
{
SETVALUE("QTGender",SYSRAND(1,2));
}

End Unverified
```

Note #1:I have assumed your gender question is Q1. Change all Q1's in your Perl Script to whatever your question number should be.
Note #2:I have assumed your gender quota variable is QTGender. Change all QTGender's in your Perl Script to whatever you prefer.

3/ Create your quota question with 2 cells ...
1=Male, set the logic to QTGender=1
2=Female, set the logic to QTGender=2

If I have assumed incorrectly about the gender being asked, and it is a pass-in variable instead, the above approach will still work nicely.
answered May 12 by Platinum (98,670 points)
edited May 12