Using lookup tables to filter out options

Dear All

I want to filter out relationship codes based on the gender of a person. I have prepared a lookup table and uploaded it on the lookup table section. I want to know how we can call the lookup table on the filter. Do we write $lookup table_name

Thank you


In the table TABLENAME locate the row with rowcode equal to rowindexint and return a value from ColumnName.

Dear Sergiy

My look up table name is relation_fliter. I am not able to understand what rowindex_int and column name is

rowcode Q1_4
3 1
4 2
5 1
6 2
7 1
8 2
9 1
10 2
11 1
12 2
13 1
14 2
15 1
16 2
17 1
18 2
19 1
20 2
21 2
22 1
24 1
25 2

This is a part of my lookup table. Can you tell me know to call the look up table

Suppose your table name is T, then, for example
T[10].Q1_4 evaluates to 2
T[22].Q1_4 evaluates to 1.

What you search in the lookup table should depend on the task you are solving. In the filter you can use @optioncode to refer to option codes.

Dear Sergiy

Then what would be an easier syntax to write for if I want relationship code 3,5,7,,22,24 to be displayed for male(code1) and 4,6,8,10,12,14,16,18,21,25 to be displayed for female (code 2) using optioncode and relation code 1 and 2 to be displayed for both male and female

Perhaps something along the lines:

(@optioncode.InList(3,5,7,8,11,15,17,19,22,24) && (sex==1))
(@optioncode.InList(4,6,8,10,12,14,16,18,21,25) && (sex==2))

Note that you’ve mentioned 8 twice in your lists. Which is likely an error as 9,13, 20 and 23 are not mentioned at all. So do take care and test each individual option.

This is working fine. But How can I filter out age and education grade

For age less than 15 (avoid grade 13,14,15,16)
For age less than 10(avoid grade 8,9,10,11,12,13,14,15,16)
For age less than 5(avoid grade 2-16)
for age above 15 (Avoid grade 0,1,2)

how can I filter that. I was thinking of using lookup table but I am not sure how to call it.