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's gravatar image

Andras
18482253
accept rate: 0%

edited 09 Oct '14, 21:15


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.

permanent link

answered 09 Oct '14, 21:49

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.8k119
accept rate: 19%

Dear user,
If accessibility is a Boolean attribute you can use just:

  • accessibility (that is equivalent to accessibility = true() )
  • not(accessibility) (equivalent to accessibility = false() )

accessibilty = '1' or accessibility = '0' can be used only if accessibility is a Code attribute.

Thanks,
Open Foris Team

permanent link

answered 13 Oct '20, 15:56

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
4.8k119
accept rate: 19%

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


  • accessibility = '1'

meaning that this survey attribute only appears when 'accessibility' was assessed as '1' i.e. not accessible, or you can write the following expression


  • accessibility = '0'

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,


  • accessibility = '5'

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


  • (accessibility = '2') or (accessibility = '3')

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


  • (accessibility = '2') and (agriculture_type = '3')

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


  • agriculture_type

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


  • agriculture_type != '3'

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.

permanent link

answered 13 Oct '20, 15:31

EarthOrbGIS's gravatar image

EarthOrbGIS
1758
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×494

question asked: 09 Oct '14, 20:40

question was seen: 7,374 times

last updated: 13 Oct '20, 15:56