# How to add relevant tests in Build

**URL:** <https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245>\
**Category:** Support\
**Tags:** odk-build\
**Created:** [October 16, 2017, 7:58pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245 "2017-10-16T19:58:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raiar\_Toscan](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/raiar_toscan/32/2666_2.png) [@Raiar\_Toscan](https://forum.getodk.org/u/Raiar_Toscan)\
**Post date:** [October 16, 2017, 7:58pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/1 "2017-10-16T19:58:31Z")

</div>

Hello,  
I have a question regarding the logic (rules) of the questionnaire.  
I'm using odk build and I need question 4 to appear only if the answer to question 2 is "Other" (value 3).  
I tried to use in the Relevance field in question 4 the following codes:

(selected (national, '3'))  
$ {national} = '3'

relevant = "(selected (national, '3'))"  
relevant = "$ {national} = '3'"

None worked. Is it possible to do what I need?

Thank you

---

<div class="post-metadata">

**Author:** ![jruizc](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jruizc/32/2613_2.png) [@jruizc](https://forum.getodk.org/u/jruizc)\
**Post date:** [October 16, 2017, 9:00pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/2 "2017-10-16T21:00:12Z")

</div>

Try with:

selected(${national},'3')

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [October 16, 2017, 10:38pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/3 "2017-10-16T22:38:42Z")

</div>

The `${}` syntax is introduced by XLSForm. If you are using Build, you will use XPath syntax. For example, if you're using a select one, you can use `/data/national = 3`. If you are using a select multiple you can use `selected(/data/national, 3)`.

---

<div class="post-metadata">

**Author:** ![Raiar\_Toscan](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/raiar_toscan/32/2666_2.png) [@Raiar\_Toscan](https://forum.getodk.org/u/Raiar_Toscan)\
**Post date:** [October 17, 2017, 3:38pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/4 "2017-10-17T15:38:44Z")

</div>

Worth it!  
Thank you all.

---

<div class="post-metadata">

**Author:** ![tjaramillo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@tjaramillo](https://forum.getodk.org/u/tjaramillo)\
**Post date:** [October 16, 2018, 8:49pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/5 "2018-10-16T20:49:14Z")

</div>

Hi Hélene, what the syntax would look like in ODK build if I am using a select multiple and I want to use relevant if two options are chosen? Thank you,

---

<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:** [October 16, 2018, 8:54pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/6 "2018-10-16T20:54:03Z")

</div>

> [@tjaramillo](#):
>
> using a select multiple and I want to use relevant if two options are chosen

Try:

`relevant="count-selected(${my_multi_select})=2"`

See [count-selected()](https://docs.opendatakit.org/form-operators-functions/#count-selected) for details.

---

<div class="post-metadata">

**Author:** ![tjaramillo](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/t/7c8e57/32.png) [@tjaramillo](https://forum.getodk.org/u/tjaramillo)\
**Post date:** [October 16, 2018, 9:47pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/7 "2018-10-16T21:47:38Z")

</div>

Thank you Xiphware, what would be the syntax if I am using ODK build and not XML?

---

<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:** [October 16, 2018, 9:58pm UTC](https://forum.getodk.org/t/how-to-add-relevant-tests-in-build/10245/8 "2018-10-16T21:58:36Z")

</div>

per @LN 's earlier response, `${my_multi_select}` is the XLSForm syntax, whereas ODK Build directly uses XML, which will instead be something like "/data/my\_multi\_select" , assuming that "my\_multi\_select" is the Data Name you used to identify your select multiple question. Note, if this question is located within a group, you'll also have to include the group id in the path, eg "/data/my\_group/my\_multi\_select"
