Hi, When I refer to a code list value in e.g. a relevancy expression of an attribute, should I use the code or the code label? For instance I want that an attribute is relevant when the code attribute "accessibility" takes the value 1 (code label: "Accessible"). Which of the following is correct? Relevant when: accessibility=1 or Relevant when: accessibility="Accessible" Thanks! asked 09 Oct '14, 20:40 Andras |
Hi, when referencing a code attribute, only the code will be considered (don't forget that you can define surveys in multiple languages and you can define different labels for the same code item...). The right expression will be: accessibility='1' Don't forget that the code is a alphanumeric value, so you have to wrap it into single or double quotes when you want to use it as a value in an expression. Thanks. answered 09 Oct '14, 21:49 Stefano (OF) ♦♦ |
Dear user,
accessibilty = '1' or accessibility = '0' can be used only if accessibility is a Code attribute. Thanks, answered 13 Oct '20, 15:56 Stefano (OF) ♦♦ |
Hi I know this discussion thread is slightly dated, but I would like to add some points from my own experience for other users who are looking for information regarding using expressions in the Survey Designer >>> Schema >>> Attribute >>> Relevant >>> Only when expression is verified If 'accessibility' is a Boolean attribute, you can use
meaning that this survey attribute only appears when 'accessibility' was assessed as '1' i.e. not accessible, or you can write the following expression
meaning that this next attribute only appears when 'accessibility' was assessed as '0' i.e. accessible. If 'accessibility' is instead a Code attribute with multiple code elements as listed in Survey Designer >>> Code Lists, you may use similar expressions as before to configure your survey such that the next attribute only appears when a certain code list element (numerical) is selected,
meaning that the next attribute only appears when 'accessibility' was assessed as '5'. Also, to include multiple conditions for the expression, you can use simple conditional expressions
meaning that this next attribute only appears when 'accessibility' was assessed as either '2' or '3' If you have another code attribute (e.g. 'agriculture_type'), then you can write the following expression
meaning that this next attribute only appears when 'accessibility' and 'agriculture_type' was assessed as '2' and '3' respectively. A less common example, is if you want a question to pop up when any list element was selected in the previous question. In this case, you would write the following expression
meaning that if you select any code list element under 'agriculture_type', this next survey question will appear. Finally, you can write the following expression to exclude certain scenarios
meaning that the next survey question will pop up as long as you select any other code element other than '3' for 'agricultural_type'. To clarify != is the notation used for 'not equals to' Hope you will find this helpful. answered 13 Oct '20, 15:31 EarthOrbGIS |