# Syntax validity

**URL:** <https://forum.getodk.org/t/syntax-validity/14462>\
**Category:** Support\
**Created:** [August 8, 2018, 10:23am UTC](https://forum.getodk.org/t/syntax-validity/14462 "2018-08-08T10:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vineet\_Jk](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/v/278dde/32.png) [@Vineet\_Jk](https://forum.getodk.org/u/Vineet_Jk)\
**Post date:** [August 8, 2018, 10:23am UTC](https://forum.getodk.org/t/syntax-validity/14462/1 "2018-08-08T10:23:22Z")

</div>

**What is the problem? Please be detailed.**  
\<selected(${demographic\_residence}, 2, 3, 4, 5, 6)\> is this code correct in syntax for conditionally showing question in relevance column in xls form

**What ODK tool and version are you using? And on what device and operating system version?**  
creating xls form for uploading to odk aggreate  
**What steps can we take to reproduce the problem?**

**What you have you tried to fix the problem?**

**Anything else we should know or have? If you have a test form or screenshots or logs, attach here.**

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [August 8, 2018, 10:31am UTC](https://forum.getodk.org/t/syntax-validity/14462/2 "2018-08-08T10:31:36Z")

</div>

> [@Vineet\_Jk](#):
>
> \<selected(${demographic\_residence}, 2, 3, 4, 5, 6)\> is this code correct...

Probably not. [selected()](https://docs.opendatakit.org/form-operators-functions/#selected) is used to see if a (single) string that you want to check is among those selected in a multi-select; eg `selected(${answer},'blue')`

Inferring that your `demographic_residence` is a multi-select, whose item values are '1', '2', '3', etc, then you will need to explicitly check whether each of these has been selected; eg

`selected(${demographic_residence},'2') or selected(${demographic_residence},'3') or ... ` and so on

---

<div class="post-metadata">

**Author:** ![Vineet\_Jk](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/v/278dde/32.png) [@Vineet\_Jk](https://forum.getodk.org/u/Vineet_Jk)\
**Post date:** [August 8, 2018, 11:25am UTC](https://forum.getodk.org/t/syntax-validity/14462/3 "2018-08-08T11:25:15Z")

</div>

thank you. it worked.
