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: