I am trying to filter the weight descriptions for food items captured by a household using a lookup table. My lookup table uses fooditem are in the rowcode field and I have a weight category
field. I have over 800 food items from the COICOP.
I have read the lookup table article and forum answers but I am not understanding how to write this filter code
Dear @neville_csoit, you can create lookup table where you can set optioncode as rowcode.
This need for quick access to lookup table data by optioncode.
In this case you can use it in filter wgt_fil[@optioncode].wgt_lock == 1
this expression will be run for each option, and in result you can see only options in column “wgt_lock” equals to 1.
Thanks for your reply,
I am not understanding you answer for my situation, I don’t think I explained my situation correctly. I have 21 options that repeat for different food items.
So my lookup table had the itemcode for food item as rowcode
112100
so I have weighted measures (Kgs, gms, llbs ounces) and other items which use the weight measures plus things like bundles or only for the item.
So I am trying to limit the weight measure for each food item
Sorry was editing my reply and it posted it
I am not seeing how spuv’s answer will work for me.
My proposed lookup table has the food item code in rowcode and the weight filter lock column 1
food label white flour rowcode 111 and weight code 1 would refer to option codes kgs, gms, llbs, Ozs
rowcode wgt_lck
111 1
121 2
where 121 is bottled water for example.so its option codes would be L, mls, Gallon etc
as shown below
congratulations on figuring this out. It’s hard for others to advise here, since whatever the “weight filter lock column” is, is probably very specific to your survey.
Still note that the use of the “&”-operator is almost certainly wrong in Survey Solutions in general and here in particular. You should receive a warning regarding this in the Designer when you compile the questionnaire with such a condition.
Also, consider simplifying the whole expression that you’ve posted to a single equality check by using a second lookup table.