<?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: Nested if/selection statements not working in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1105367#M37900</link>
    <description>&lt;P&gt;Thanks so much!&amp;nbsp; Worked like a charm!&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 21:56:20 GMT</pubDate>
    <dc:creator>KaitlynAbrahamson</dc:creator>
    <dc:date>2021-10-06T21:56:20Z</dc:date>
    <item>
      <title>Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027302#M32509</link>
      <description>&lt;P&gt;Hello! I am creating a conditional calculation for an integer field based on selection/input in a different field.&amp;nbsp; To me, this seemed like a simple nested if statement, so please help me fix where I am going wrong with the logic or formatting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;I've attached a word doc with all of the different attempts&lt;/U&gt;, but below is the last one I tried, selection options '2'-'6' are domain values for the field name &lt;EM&gt;ObstructionImpacted&lt;/EM&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;(if(selected(${ObstructionImpacted},’2’),5div10), if(selected(${ObstructionImpacted},’3’),2div10), if(selected(${ObstructionImpacted},’4’),4div10), if(selected(${ObstructionImpacted},’5’),1div10), if(selected(${ObstructionImpacted},’6’),1),0)&lt;/P&gt;&lt;P&gt;So basically the logic I am trying to calculate is:&lt;/P&gt;&lt;P&gt;IF {&lt;EM&gt;ObstructionImpacted&lt;/EM&gt;} = '2' then calculate 5/10&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF {&lt;EM&gt;ObstructionImpacted&lt;/EM&gt;} = '3' then calculate 2/10&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF {&lt;EM&gt;ObstructionImpacted&lt;/EM&gt;} = '4' then calculate 4/10&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF {&lt;EM&gt;ObstructionImpacted&lt;/EM&gt;} = '5' then calculate 1/10&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF {&lt;EM&gt;ObstructionImpacted&lt;/EM&gt;} = '3' then the result is 1&lt;/P&gt;&lt;P&gt;OR the result is 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1213"&gt;@JamesTedrick&lt;/a&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 20:09:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027302#M32509</guid>
      <dc:creator>MeghanJones</dc:creator>
      <dc:date>2021-02-16T20:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027333#M32512</link>
      <description>&lt;P&gt;Each has it own errors.&amp;nbsp; Try this one with some spaces missing.&amp;nbsp; Also all the parens all go at the end.&lt;/P&gt;&lt;P&gt;(if(selected(${ObstructionImpacted}, ’2’), 5 div 10, if(selected(${ObstructionImpacted}, ’3’), 2 div 10, if(selected(${ObstructionImpacted}, ’4’), 4 div 10, if(selected(${ObstructionImpacted}, ’5’), 1 div 10, if(selected(${ObstructionImpacted}, ’6’), 1 , 0)))))&lt;/P&gt;&lt;P&gt;Hope that does it&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 21:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027333#M32512</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-02-16T21:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027339#M32515</link>
      <description>&lt;P&gt;That did it! Thank you SO MUCH! This helps me write several more codes in my form as well; I really appreciate it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 21:19:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1027339#M32515</guid>
      <dc:creator>MeghanJones</dc:creator>
      <dc:date>2021-02-16T21:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104824#M37837</link>
      <description>&lt;P&gt;I'm having a similar issue with this kind of nested if statement.&amp;nbsp; I'm not sure if I am able to do a calculation like this with text instead of numbers. What I am trying to do is add a hidden field of "category."&amp;nbsp; I want some utilities labeled as Water, or Sanitary, or Storm all in one field.&lt;/P&gt;&lt;P&gt;Would someone look to see what I'm doing wrong, because I keep getting this automatic entry on the actual survey: ReferenceError: Water is not defined in expression.&lt;/P&gt;&lt;P&gt;(if(selected(${utility}, 'Hydrant'), Water Distribution, if(selected(${utility}, 'Gate Valve'), Water Distribution, if(selected(${utility}, 'Curb Stop'), Water Distribution, if(selected(${utility}, 'Sanitary Manhole'), Sanitary Sewer, if(selected(${utility}, 'Clean Out'), Sanitary Sewer, if(selected(${utility}, 'Storm Manhole'), Storm Drain, if(selected(${utility}, 'Inlets/Catch Basin'), Storm Drain, Other))))))))&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:28:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104824#M37837</guid>
      <dc:creator>KaitlynAbrahamson</dc:creator>
      <dc:date>2021-10-05T15:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104830#M37838</link>
      <description>&lt;P&gt;Hi Kaitlyn&lt;/P&gt;&lt;P&gt;You just needed to put single quotes around the true parts of your if statement:&lt;/P&gt;&lt;P&gt;(if(selected(${utility}, 'Hydrant'), 'Water Distribution', if(selected(${utility}, 'Gate Valve'), 'Water Distribution', if(selected(${utility}, 'Curb Stop'), 'Water Distribution', if(selected(${utility}, 'Sanitary Manhole'), 'Sanitary Sewer', if(selected(${utility}, 'Clean Out'), 'Sanitary Sewer', if(selected(${utility}, 'Storm Manhole'), 'Storm Drain', if(selected(${utility}, 'Inlets/Catch Basin'), 'Storm Drain', 'Other'))))))))&lt;/P&gt;&lt;P&gt;It was complaining about 'water' not being a defined expression because it was the first string that wasnt quoted in single quotations.&lt;/P&gt;&lt;P&gt;Hope that helps. If there's still issues then please post your survey, it would make it easier to assist&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:32:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104830#M37838</guid>
      <dc:creator>DeonLengton</dc:creator>
      <dc:date>2021-10-05T15:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104850#M37840</link>
      <description>&lt;P&gt;If it gets any bigger than this use pulldata to go get the category it will be easier.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 15:53:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1104850#M37840</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-10-05T15:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if/selection statements not working</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1105367#M37900</link>
      <description>&lt;P&gt;Thanks so much!&amp;nbsp; Worked like a charm!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 21:56:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/nested-if-selection-statements-not-working/m-p/1105367#M37900</guid>
      <dc:creator>KaitlynAbrahamson</dc:creator>
      <dc:date>2021-10-06T21:56:20Z</dc:date>
    </item>
  </channel>
</rss>

