<?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 Conditional Calculation on Conditionally Relevant Field in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795939#M9468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if I can use an "if" statement in my survey to create a conditional calculation for a Total Cost field (integer) who's calculation is dependent on&amp;nbsp;{epm} = Yes versus when &lt;SPAN&gt;{epm}&lt;/SPAN&gt; = No.&lt;/P&gt;&lt;P&gt;The condition would be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(${&lt;SPAN&gt;epm}&lt;/SPAN&gt;, 'yes') then&amp;nbsp;total_cost&amp;nbsp;= ${epm_cost}+ ${repair_cost}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if(${epm}, 'no') then&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;total_cost&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= ${repair_cost}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The kicker is that&amp;nbsp;&lt;SPAN&gt;{epm}&lt;/SPAN&gt; is only relevent when &lt;STRONG&gt;c&lt;/STRONG&gt;&lt;STRONG&gt;at_a, cat_c, or cat_d&lt;/STRONG&gt;&amp;nbsp;(and so forth) are selected.&lt;/P&gt;&lt;P&gt;When &lt;STRONG&gt;Cat_B&lt;/STRONG&gt; is selected,&amp;nbsp;&lt;SPAN&gt;{epm}&lt;/SPAN&gt; &lt;STRONG&gt;cannot&lt;/STRONG&gt; be relevant&lt;/P&gt;&lt;P&gt;I've set the default of&amp;nbsp;&lt;SPAN&gt;{epm_cost}, {repair_cost}, and {total_cost} to 0 so that the calculate is run regardless of an actual cost being entered. However, when {epm} is 'no',&amp;nbsp; {epm} is not relevant&amp;nbsp;and therefore not included into the {total_cost} calculation creating a Null {total_cost}.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a copy of the specific lines from my survey as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thoughts???&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jun 2020 19:27:48 GMT</pubDate>
    <dc:creator>JaredRyan1</dc:creator>
    <dc:date>2020-06-08T19:27:48Z</dc:date>
    <item>
      <title>Conditional Calculation on Conditionally Relevant Field</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795939#M9468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if I can use an "if" statement in my survey to create a conditional calculation for a Total Cost field (integer) who's calculation is dependent on&amp;nbsp;{epm} = Yes versus when &lt;SPAN&gt;{epm}&lt;/SPAN&gt; = No.&lt;/P&gt;&lt;P&gt;The condition would be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(${&lt;SPAN&gt;epm}&lt;/SPAN&gt;, 'yes') then&amp;nbsp;total_cost&amp;nbsp;= ${epm_cost}+ ${repair_cost}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;if(${epm}, 'no') then&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;total_cost&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= ${repair_cost}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The kicker is that&amp;nbsp;&lt;SPAN&gt;{epm}&lt;/SPAN&gt; is only relevent when &lt;STRONG&gt;c&lt;/STRONG&gt;&lt;STRONG&gt;at_a, cat_c, or cat_d&lt;/STRONG&gt;&amp;nbsp;(and so forth) are selected.&lt;/P&gt;&lt;P&gt;When &lt;STRONG&gt;Cat_B&lt;/STRONG&gt; is selected,&amp;nbsp;&lt;SPAN&gt;{epm}&lt;/SPAN&gt; &lt;STRONG&gt;cannot&lt;/STRONG&gt; be relevant&lt;/P&gt;&lt;P&gt;I've set the default of&amp;nbsp;&lt;SPAN&gt;{epm_cost}, {repair_cost}, and {total_cost} to 0 so that the calculate is run regardless of an actual cost being entered. However, when {epm} is 'no',&amp;nbsp; {epm} is not relevant&amp;nbsp;and therefore not included into the {total_cost} calculation creating a Null {total_cost}.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a copy of the specific lines from my survey as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thoughts???&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2020 19:27:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795939#M9468</guid>
      <dc:creator>JaredRyan1</dc:creator>
      <dc:date>2020-06-08T19:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Calculation on Conditionally Relevant Field</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795940#M9469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure why your relevant&amp;nbsp; on line 3 is not the opposite like != '' should work.&amp;nbsp; That Or sting-length() &amp;gt; 0 will tell you when something is still empty.&amp;nbsp; Having all those or statements with the value is slower.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For epm just add a second hidden field.&amp;nbsp; You can do the same string-length trick above or just use epm ='yes' again (no need to use selected just = is fine).&lt;/P&gt;&lt;P&gt;So if(${epm}='yes',${epm_cost},0)&amp;nbsp; &amp;nbsp; then use this hidden field in your calc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jun 2020 19:50:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795940#M9469</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2020-06-08T19:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Calculation on Conditionally Relevant Field</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795941#M9470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Doug! This works for what I'm needing, with the one exception that my total_cost is concatenating the new hidden field instead of adding it to the total as a sum. I believe this is a separate issue as I have verified my bind::esri:fieldType is set to esriFieldTypeInteger. I have also created a new identical survey to first publish with the new hidden field as an integer and then republish as hidden and esriFieldTypeInteger and it's still concatenating. My total_cost calc is coalesce(${epm_cost},0)+&lt;SPAN&gt;coalesce(${repair_cost},0)+coalesce(${epm_cost_b},0) where epm_cost_b is the new hidden field.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2020 15:23:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795941#M9470</guid>
      <dc:creator>JaredRyan1</dc:creator>
      <dc:date>2020-06-09T15:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Calculation on Conditionally Relevant Field</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795942#M9471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to set bind::type one to int instead.&amp;nbsp; Or use number().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2020 15:37:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795942#M9471</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2020-06-09T15:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Calculation on Conditionally Relevant Field</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795943#M9472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah thank you! I hadn't even realized I was using an old survey form that did not have the bind::type column.. All good now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2020 16:35:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/conditional-calculation-on-conditionally-relevant/m-p/795943#M9472</guid>
      <dc:creator>JaredRyan1</dc:creator>
      <dc:date>2020-06-09T16:35:22Z</dc:date>
    </item>
  </channel>
</rss>

