Save value from roster question for validation check later

Hello, my survey includes a roster called cattle_type with a questions that asks for the number of each cattle type owned by the household (e_num_owned). This source question for the roster is the multi-select question e_own_cattle that records the types of cattle owned by the household (e.g. 1 calves, 2 cows, 3 bulls). I would like to save the value reported for number of cows owned (e_num_owned if @rowcode=2) in a variable but I’m not sure what syntax to use. I need to do this in order to use this information for a validation check in another section of the survey (i.e. number of cows milked in the dry season should be less than or equal to number of cows owned).

Assuming number of livestock owned was declared as integer, you can add a Long-typed variable NumCows defined as:

NumCows = cattle_type[2].e_num_owned

or select other appropriate name for your new variable.

You probably don’t need to export it, as it is essentially a copy of information contained elsewhere. There is a flag for that.