<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Relevant expression question in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304950#M50392</link>
    <description>&lt;P&gt;I have the following relevant expression:&lt;/P&gt;&lt;P&gt;${TRANSECT_NUM}='4' or ${TRANSECT_NUM}='8' or ${TRANSECT_NUM}='12'or ${TRANSECT_NUM}='16'or ${TRANSECT_NUM}='20' or ${TRANSECT_NUM}='24'or ${TRANSECT_NUM}='28'or ${TRANSECT_NUM}='32'or ${TRANSECT_NUM}='36'or ${TRANSECT_NUM}='40'&lt;/P&gt;&lt;P&gt;The expression works fine, but is there a way to condense, so it is not so lengthy? Something like selected$(TRANSECT_NUM} = 4,8,12,16, etc.?&lt;/P&gt;&lt;P&gt;The TRANSECT_NUM field is an integer field and calculated based on the count of another field, so I can't use the selected expression.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2023 16:23:00 GMT</pubDate>
    <dc:creator>BryceHancock</dc:creator>
    <dc:date>2023-06-30T16:23:00Z</dc:date>
    <item>
      <title>Relevant expression question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304950#M50392</link>
      <description>&lt;P&gt;I have the following relevant expression:&lt;/P&gt;&lt;P&gt;${TRANSECT_NUM}='4' or ${TRANSECT_NUM}='8' or ${TRANSECT_NUM}='12'or ${TRANSECT_NUM}='16'or ${TRANSECT_NUM}='20' or ${TRANSECT_NUM}='24'or ${TRANSECT_NUM}='28'or ${TRANSECT_NUM}='32'or ${TRANSECT_NUM}='36'or ${TRANSECT_NUM}='40'&lt;/P&gt;&lt;P&gt;The expression works fine, but is there a way to condense, so it is not so lengthy? Something like selected$(TRANSECT_NUM} = 4,8,12,16, etc.?&lt;/P&gt;&lt;P&gt;The TRANSECT_NUM field is an integer field and calculated based on the count of another field, so I can't use the selected expression.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 16:23:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304950#M50392</guid>
      <dc:creator>BryceHancock</dc:creator>
      <dc:date>2023-06-30T16:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Relevant expression question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304978#M50393</link>
      <description>&lt;P&gt;$(TRANSECT_NUM) in ('4','8','12')&amp;nbsp; etc. with other values&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 17:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304978#M50393</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2023-06-30T17:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Relevant expression question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304987#M50395</link>
      <description>&lt;P&gt;Thanks Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried this with the following expression and received a message that it could not understand the expression.&lt;/P&gt;&lt;P&gt;${TRANSECT_NUM} in ('4','8','12','16','20','24','28','32','36','40')&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 17:41:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304987#M50395</guid>
      <dc:creator>BryceHancock</dc:creator>
      <dc:date>2023-06-30T17:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Relevant expression question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304991#M50396</link>
      <description>&lt;P&gt;As far as I've found, Survey123 does not support the 'value in list' type of expression, however &lt;A href="https://docs.getodk.org/form-operators-functions/#selected" target="_self"&gt;ODK&lt;/A&gt; indicates that the selected() function might support a similar thing - however, in testing this with S123, ESRI does not appear to support it being used in this way. That leaves us with a few workarounds, but they are typically not as clear or explicit or easy to understand as the built up query that you have.&amp;nbsp; In your case, queries such as:&lt;BR /&gt;&lt;BR /&gt;(${transect} &amp;lt; 41 and ${transect} mod 4 = 0) or (${transect} = 28)&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;contains("4,8,12,16,20,24,28,32,36,40", string(${transect})) and string-length(${transect})&amp;gt;0&lt;BR /&gt;&lt;BR /&gt;appear to work with your specific list, however users coming to work on your survey in the future might not clearly understand what your expression is trying to do.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Being frustrated in the past that Suryey123 did not appear to support this type of thing, this is what I came up with:&lt;/P&gt;&lt;P&gt;1. Add a select multiple where the default value is set to include all the valid choices.&amp;nbsp; Set the body::esri::visible to hide this question (use something like 1=2), and set the bind:esri:fieldType to null so that no field is created in for this.&lt;/P&gt;&lt;P&gt;2. use the formula: selected(${multiple_selection_question}, string(${TRANSECT_NUM})) in the relevant.&lt;/P&gt;&lt;P&gt;Here is my tested and functioning sample:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fklotz_0-1688146955055.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74634i69433B5615254111/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fklotz_0-1688146955055.png" alt="fklotz_0-1688146955055.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Of course you need the choices:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fklotz_1-1688146979336.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74635i48D33717EDD03FCD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fklotz_1-1688146979336.png" alt="fklotz_1-1688146979336.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This approach can easily be reused, although it is relatively static, if you needed to generate the valid choices on the fly, you might need a very long choice list or external csv.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 17:44:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/relevant-expression-question/m-p/1304991#M50396</guid>
      <dc:creator>fklotz</dc:creator>
      <dc:date>2023-06-30T17:44:27Z</dc:date>
    </item>
  </channel>
</rss>

