Can't convert int? to int with lookup table

Hi, I’m new to SurveySolutions, so I apologize if this is basic, but I haven’t been able to figure out the answer on my own.

I’m trying to program a survey to include a Lookup Table (called lookup_test1). I’ll be using the Lookup Table to compare the unique ID (entered in unique_id) to the rowcode in the Lookup Table and pull the treatment status of the individual based on this. There are questions in the survey that will only be asked to those in the treatment group, so I’ll be using this as an enabling condition similar to the following:

lookup_test1[unique_id].treat=1 (where “treat” is the name of the column in the Lookup Table with a dummy for treatment status)

I’d also like to use the Lookup Table to confirm the ID entered is part of the sample (e.g. if unique_id!=rowcode, it should produce an error.) (Including this check would be nice, but not required if it’s impossible)

We won’t be assigning specific cases to specific enumerators, so preloads with specific assignments aren’t possible.

When I compile my survey, I get the error "Argument 1 cannot be converted from ‘int?’ to ‘int’:

To try and correct for this, I added the “int” function to the expression (such as lookup_test1[(int)unique_id].treat=1) , but then got the error “The property or indexer ‘Lookup__Lookup_test1.treat’ cannot be used in this context because the set accessor in inaccessible”

Given this, I haven’t been able to figure out how to make this work.

The table itself is tab-delimited and just has two columns: (1) rowcode (which is a 4 digit number) and (2) treat (which is binary).

I’ve uploaded a shell of the survey (without the lookup table or related expressions, since these caused errors) to the Demo Server as “Lookup_test”.

I’d like to add an enabling condition like the following to the section called “Questions for Treatment cases”, as described above.

I’d also, ideally, like to add a validating condition to the question called “treatment” like the following (which would confirm the ID entered matched one rowcode in the Lookup table and that the treatment entered by the enumerator matches the treatment in the lookup table for this household:



  1. you were on the right track with the above, indeed add (int) type cast (you need it since, basically, missing is not allowed as an indexer of an array). The remaining message is related to using a single equal sign “=”, whereas double equal sign “==” should be used for probing equality.

  2. you were [probably, most likely] on the wrong track with the idea of checking whether the unique id was part of the sample. Declare it as an identifying question and preload the answer in an assignment.

WHY? That’s the whole point of an assignment is to make sure your interviewers are not going to enter bogus IDs that will not match later to the data you have already in the office.

Similarly, do preload the treatment status.

For everyone else reading this: lookup tables are created and used for a different purpose. You will run into a problem with larger surveys if you attempt to do what Ron is trying to do here.

Best, Sergiy Radyakin