<?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 Using Conditional &amp;quot;where&amp;quot; function inside an &amp;quot;if&amp;quot; statement in Survey 123 reports to give count only if greater than zero in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/using-conditional-quot-where-quot-function-inside/m-p/1685248#M65454</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a building survey with a repeat that has information on features on the building. One of the questions in the repeat is type and has a domain with 30 or so options.&lt;/P&gt;&lt;P&gt;In my report, I am trying to get a count of the number of features of each specific type, but only return the text and number if that number is greater than zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can successfully return the count of each feature type if there are one or more features using :&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| getValue:"count")&amp;gt;0}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option1: ${Features_repeat | where:"FeatureType='Option1'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option2: ${Features_repeat | where:"FeatureType='Option2'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option3: ${Features_repeat | where:"FeatureType='Option3'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;...&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${/}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;which would return something that looks like:&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 1: 0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 2: 1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 3: 0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;however with over 30 options,&amp;nbsp;I only want to show the counts of those where the feature type is present (Option 2) and discard any that don't have any (Option 1 &amp;amp; 3) so i don't have lots of rows with zero counts. So the above would become&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 2: 1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;I have tried including the "where" function inside the if and having one statement per choice as below but it returns invalid syntax&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| where:"FeatureType='Option1'"|getValue:"count")&amp;gt;0}&lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;number of Option1: ${Features_repeat | where:"FeatureType='Option1'"|getValue:"count"}&lt;FONT color="#339966"&gt;${/}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| where:"FeatureType='Option2'"|getValue:"count")&amp;gt;0}n&lt;FONT color="#0000FF"&gt;umber of Option2: ${Features_repeat | where:"FeatureType='Option2'"|getValue:"count"}&lt;/FONT&gt;${/}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;...&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;It seems that the where function is not valid within the if statement.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Does anyone know of a way to show the count for select features within a repeat, and only show if they are present. Theoretically i would also like to use this for stats to calculate averages, minimum, maximum etc but from filtered lists and only show those where the count of type is greater than zero.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Feb 2026 13:33:55 GMT</pubDate>
    <dc:creator>ChristopherDawe</dc:creator>
    <dc:date>2026-02-20T13:33:55Z</dc:date>
    <item>
      <title>Using Conditional "where" function inside an "if" statement in Survey 123 reports to give count only if greater than zero</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/using-conditional-quot-where-quot-function-inside/m-p/1685248#M65454</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a building survey with a repeat that has information on features on the building. One of the questions in the repeat is type and has a domain with 30 or so options.&lt;/P&gt;&lt;P&gt;In my report, I am trying to get a count of the number of features of each specific type, but only return the text and number if that number is greater than zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can successfully return the count of each feature type if there are one or more features using :&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| getValue:"count")&amp;gt;0}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option1: ${Features_repeat | where:"FeatureType='Option1'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option2: ${Features_repeat | where:"FeatureType='Option2'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;number of Option3: ${Features_repeat | where:"FeatureType='Option3'"|getValue:"count"}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;...&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${/}&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;which would return something that looks like:&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 1: 0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 2: 1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 3: 0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;however with over 30 options,&amp;nbsp;I only want to show the counts of those where the feature type is present (Option 2) and discard any that don't have any (Option 1 &amp;amp; 3) so i don't have lots of rows with zero counts. So the above would become&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#800000"&gt;number of Option 2: 1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;I have tried including the "where" function inside the if and having one statement per choice as below but it returns invalid syntax&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| where:"FeatureType='Option1'"|getValue:"count")&amp;gt;0}&lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;number of Option1: ${Features_repeat | where:"FeatureType='Option1'"|getValue:"count"}&lt;FONT color="#339966"&gt;${/}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#339966"&gt;${if (Features_repeat| where:"FeatureType='Option2'"|getValue:"count")&amp;gt;0}n&lt;FONT color="#0000FF"&gt;umber of Option2: ${Features_repeat | where:"FeatureType='Option2'"|getValue:"count"}&lt;/FONT&gt;${/}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;...&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;It seems that the where function is not valid within the if statement.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Does anyone know of a way to show the count for select features within a repeat, and only show if they are present. Theoretically i would also like to use this for stats to calculate averages, minimum, maximum etc but from filtered lists and only show those where the count of type is greater than zero.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 13:33:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/using-conditional-quot-where-quot-function-inside/m-p/1685248#M65454</guid>
      <dc:creator>ChristopherDawe</dc:creator>
      <dc:date>2026-02-20T13:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using Conditional "where" function inside an "if" statement in Survey 123 reports to give count only if greater than zero</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/using-conditional-quot-where-quot-function-inside/m-p/1685974#M65471</link>
      <description>&lt;P&gt;Try this out.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;${#Features_repeat | where:"FeatureType='Option1'"}
number of Option1: ${Features_repeat | where:”FeatureType = 'Option1'" | stats:"count,objectid"}
${/}
${#Features_repeat | where:"FeatureType='Option2'"}
number of Option2: ${Features_repeat | where:”FeatureType = 'Option2'" | stats:"count,objectid"}
${/}
${#Features_repeat | where:"FeatureType='Option3'"}
number of Option3: ${Features_repeat | where:”FeatureType = 'Option3'" | stats:"count,objectid"}
${/}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your other option could be to do the aggregation in the form in some hidden questions, then call those fields in the report.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2026 18:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/using-conditional-quot-where-quot-function-inside/m-p/1685974#M65471</guid>
      <dc:creator>Neal_t_k</dc:creator>
      <dc:date>2026-02-23T18:16:05Z</dc:date>
    </item>
  </channel>
</rss>

