<?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 Re: Calculate a field using conditional statement and values from select_one, if relevant  in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868022#M27464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you. that worked. just before my brain was about to explore. not a moment too soon!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Sep 2019 14:09:26 GMT</pubDate>
    <dc:creator>JulieRoebotham</dc:creator>
    <dc:date>2019-09-20T14:09:26Z</dc:date>
    <item>
      <title>Calculate a field using conditional statement and values from select_one, if relevant</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868020#M27462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have a survey that has a host of select_one questions. Each set of questions is categorized, each category has between 1 and 4 questions. The first thing i need to do is find the average score for each&amp;nbsp;category&amp;nbsp;of questions, and then find the total overall average.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue i'm having is that one of the categories has a relevant question. So the user is asked the first &lt;SPAN&gt;select_One&amp;nbsp;&lt;/SPAN&gt;question, and then if they select '1' (first option) they move on to the next category. If they select 2,3,or 4 from the first select_One question, they are presented with 3 more questions in that category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get the average for that category by using an if statement, but i cant get it to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example: if the answer to question 1 is '1', leave the total for this category as 1, otherwise tally up the answers to all the questions in this category and divide by the total number of questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I keep getting an error: Invalid calculate for the bind attached to ${calculatefield}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my example. Field i'm trying to calculate is&amp;nbsp;&lt;SPAN&gt;${calculatefield}, type is decimal and bind type is decimal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;anyone have any ideas!?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;(selected(&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question1},&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'1'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)),&amp;nbsp;number(&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question1}),&amp;nbsp;(number(&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question1})&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;number(&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question2})&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;number(&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question3})&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;number&lt;/SPAN&gt;&lt;SPAN style="color: #f44747;"&gt;$&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{Question4})&amp;nbsp;div&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 12:33:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868020#M27462</guid>
      <dc:creator>JulieRoebotham</dc:creator>
      <dc:date>2019-09-20T12:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a field using conditional statement and values from select_one, if relevant</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868021#M27463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have an extra ) right after selected in bold&lt;/P&gt;&lt;P&gt;if (selected(${Question1},'1')&lt;STRONG&gt;)&lt;/STRONG&gt;, number(${Question1}), (number(${Question1})+number(${Question2})+ number(${Question3})+ number${Question4}) div 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also never close the first ( in the second part in bold&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;(&lt;/STRONG&gt;number(${Question1})+number(${Question2})+ number(${Question3})+ number${Question4}) div 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any you are missing a ( in the last number&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;number$MISSING{Question4}) div 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You are also missing the final ) for the if.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also you do not have to use selected for a select_one you can just use =&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My guess is you want this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if(${Question1} ='1', number(${Question1}), (number(${Question1})+number(${Question2})+ number(${Question3})+ number(${Question4})) div 4)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 13:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868021#M27463</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2019-09-20T13:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a field using conditional statement and values from select_one, if relevant</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868022#M27464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you. that worked. just before my brain was about to explore. not a moment too soon!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2019 14:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculate-a-field-using-conditional-statement-and/m-p/868022#M27464</guid>
      <dc:creator>JulieRoebotham</dc:creator>
      <dc:date>2019-09-20T14:09:26Z</dc:date>
    </item>
  </channel>
</rss>

