<?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 Count how many times a choice is used. in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/count-how-many-times-a-choice-is-used/m-p/769210#M3270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to count the number of times a choice has been selected across many select_one questions.&lt;/P&gt;&lt;P&gt;as an example&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-7 jive-image" src="https://community.esri.com/legacyfs/online/440727_pastedImage_7.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" height="398" src="https://community.esri.com/legacyfs/online/440718_pastedImage_4.png" width="219" /&gt;&lt;IMG class="image-5 jive-image" height="396" src="https://community.esri.com/legacyfs/online/440719_pastedImage_5.png" width="228" /&gt;&lt;IMG class="image-6 jive-image" height="395" src="https://community.esri.com/legacyfs/online/440726_pastedImage_6.png" width="224" /&gt;&lt;/P&gt;&lt;P&gt;The count works when only one instance is chosen, but fails to add values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I realise this is due to the use of the 'if' statement as a control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if i use&lt;/P&gt;&lt;P&gt;if(selected(${firstchoice,'a') and selected(${secondchoice},'a'),2,if(selected(${firstchoice},'a') or selected(${secondchoice},'a'),1,0) it does work. (used for option 'c' above)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution is okay if there are only 2 options, however I want to count the number across 23 questions and the if statement would have 100's of permutations to enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There must be a better way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using hidden fields as variable to hold the count, which doesn't work, (as in the first note field above), but i cant get the addition to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using countif but that is not a recognised function, and count(selected()) only works across multiple selects which is not an option for my audit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Mar 2019 20:42:42 GMT</pubDate>
    <dc:creator>markcain</dc:creator>
    <dc:date>2019-03-28T20:42:42Z</dc:date>
    <item>
      <title>Count how many times a choice is used.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/count-how-many-times-a-choice-is-used/m-p/769210#M3270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to count the number of times a choice has been selected across many select_one questions.&lt;/P&gt;&lt;P&gt;as an example&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-7 jive-image" src="https://community.esri.com/legacyfs/online/440727_pastedImage_7.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" height="398" src="https://community.esri.com/legacyfs/online/440718_pastedImage_4.png" width="219" /&gt;&lt;IMG class="image-5 jive-image" height="396" src="https://community.esri.com/legacyfs/online/440719_pastedImage_5.png" width="228" /&gt;&lt;IMG class="image-6 jive-image" height="395" src="https://community.esri.com/legacyfs/online/440726_pastedImage_6.png" width="224" /&gt;&lt;/P&gt;&lt;P&gt;The count works when only one instance is chosen, but fails to add values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I realise this is due to the use of the 'if' statement as a control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if i use&lt;/P&gt;&lt;P&gt;if(selected(${firstchoice,'a') and selected(${secondchoice},'a'),2,if(selected(${firstchoice},'a') or selected(${secondchoice},'a'),1,0) it does work. (used for option 'c' above)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution is okay if there are only 2 options, however I want to count the number across 23 questions and the if statement would have 100's of permutations to enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There must be a better way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using hidden fields as variable to hold the count, which doesn't work, (as in the first note field above), but i cant get the addition to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using countif but that is not a recognised function, and count(selected()) only works across multiple selects which is not an option for my audit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 20:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/count-how-many-times-a-choice-is-used/m-p/769210#M3270</guid>
      <dc:creator>markcain</dc:creator>
      <dc:date>2019-03-28T20:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count how many times a choice is used.</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/count-how-many-times-a-choice-is-used/m-p/769211#M3271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've solved it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;simply used an if statement to assess which option is selected then added up each answer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(selected(${firstchoice},'a'),1,0)+if(selected(${secondchoice},'a'),1,0)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${firstchoice},'b'),1,0)+if(selected(${secondchoice},'b'),1,0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${firstchoice},'c'),1,0)+if(selected(${secondchoice},'c'),1,0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;rookie mistake.....tried to over complicate it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 21:22:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/count-how-many-times-a-choice-is-used/m-p/769211#M3271</guid>
      <dc:creator>markcain</dc:creator>
      <dc:date>2019-03-28T21:22:14Z</dc:date>
    </item>
  </channel>
</rss>

