<?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: Calculation Formula Help in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320188#M51277</link>
    <description>&lt;P&gt;You just need to nest if statements in the else part like this.&amp;nbsp; Note your chart has logic errors since you have &amp;gt;= 5 and &amp;lt;= 5 which means both are true.&amp;nbsp; I assumed &amp;lt; 5 on the first.&amp;nbsp; All of your numbers have this issue.&lt;/P&gt;&lt;P&gt;if(${NTU} &amp;lt; 1, ${NTU} + 2, if(${NTU} &amp;gt;= 1 and ${NTU} &amp;lt; 5, ${NTU} + 1, if(${NTU} &amp;gt;= 5 and ${NTU} &amp;lt; 50, ${NTU} * 1.2, if(${NTU} &amp;gt;= 50 and ${NTU} &amp;lt; 100, ${NTU} + 10, ${NTU} * 1.1))))&lt;/P&gt;&lt;P&gt;Note the above assumes the field is required.&amp;nbsp; If not add a check for "" otherwise it will get the last calc.&lt;/P&gt;&lt;P&gt;You can add another if like&amp;nbsp; if(string-length(${NTU}) &amp;gt; 0, 0, rest above&amp;nbsp; Assume you want a 0.&amp;nbsp; You could also have a relevant on the calculation so it does not calc until they fill out NTU.&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;</description>
    <pubDate>Fri, 18 Aug 2023 16:49:37 GMT</pubDate>
    <dc:creator>DougBrowning</dc:creator>
    <dc:date>2023-08-18T16:49:37Z</dc:date>
    <item>
      <title>Calculation Formula Help</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320182#M51276</link>
      <description>&lt;P&gt;Hello, I'm hoping that someone can help me with how to setup a calculation.&amp;nbsp; We are taking some field samples and depending on the initial sample value we need to apply a certain calculation if it falls within a certain range.&amp;nbsp; I'm sure we need to use if statements but not sure exactly how to do it.&amp;nbsp; Below are guidelines parameters for calculating the various ranges.&lt;/P&gt;&lt;P&gt;Basically if we get an initial sample value of 2.5 then we need to calculate the calculated turbidity by adding 1 so the new calculated value is 3.5. I'm hoping to have a single question be able to evaluate the original sample value and then apply the various calculations based on the table below.&amp;nbsp; Any help is greatly appreciated.&amp;nbsp; Thanks&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="icf_Eric_Link_0-1692376263790.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78503i92BBD359F7E8DE47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="icf_Eric_Link_0-1692376263790.png" alt="icf_Eric_Link_0-1692376263790.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 16:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320182#M51276</guid>
      <dc:creator>icf_Eric_Link</dc:creator>
      <dc:date>2023-08-18T16:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Formula Help</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320188#M51277</link>
      <description>&lt;P&gt;You just need to nest if statements in the else part like this.&amp;nbsp; Note your chart has logic errors since you have &amp;gt;= 5 and &amp;lt;= 5 which means both are true.&amp;nbsp; I assumed &amp;lt; 5 on the first.&amp;nbsp; All of your numbers have this issue.&lt;/P&gt;&lt;P&gt;if(${NTU} &amp;lt; 1, ${NTU} + 2, if(${NTU} &amp;gt;= 1 and ${NTU} &amp;lt; 5, ${NTU} + 1, if(${NTU} &amp;gt;= 5 and ${NTU} &amp;lt; 50, ${NTU} * 1.2, if(${NTU} &amp;gt;= 50 and ${NTU} &amp;lt; 100, ${NTU} + 10, ${NTU} * 1.1))))&lt;/P&gt;&lt;P&gt;Note the above assumes the field is required.&amp;nbsp; If not add a check for "" otherwise it will get the last calc.&lt;/P&gt;&lt;P&gt;You can add another if like&amp;nbsp; if(string-length(${NTU}) &amp;gt; 0, 0, rest above&amp;nbsp; Assume you want a 0.&amp;nbsp; You could also have a relevant on the calculation so it does not calc until they fill out NTU.&lt;/P&gt;&lt;P&gt;hope that helps&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 16:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320188#M51277</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2023-08-18T16:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Formula Help</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320194#M51278</link>
      <description>&lt;P&gt;I think something like this should do it. It can help to write out your expressions like this to help visually group the conditional statements. It's also very helpful to write within a text editor that uses syntax highlighting so you can keep track of matching parentheses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that line 5 is the final "Else" part of the if-statements.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if(${UT} &amp;lt; 1, ${UT} + 2, 
  if((${UT} &amp;gt;= 1) and (${UT} &amp;lt;= 5), ${UT} + 1, 
    if((${UT} &amp;gt; 5) and (${UT} &amp;lt;= 50), ${UT} * 1.2, 
       if((${UT} &amp;gt; 50) and (${UT} &amp;lt;= 100), ${UT} + 10, 
         ${UT} * 1.1
        )
     )
  )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 16:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320194#M51278</guid>
      <dc:creator>Katie_Clark</dc:creator>
      <dc:date>2023-08-18T16:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Formula Help</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320293#M51282</link>
      <description>&lt;P&gt;Thank you Doug!&amp;nbsp; This is super helpful and got me what I needed.&amp;nbsp; Much appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:17:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320293#M51282</guid>
      <dc:creator>icf_Eric_Link</dc:creator>
      <dc:date>2023-08-18T19:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Formula Help</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320294#M51283</link>
      <description>&lt;P&gt;Hi Katherine,&lt;/P&gt;&lt;P&gt;Thank you for your providing this visual.&amp;nbsp; It does indeed help with visualizing how to write the statement.&amp;nbsp; I'll make sure to use this in the future.&amp;nbsp; Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 19:18:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-formula-help/m-p/1320294#M51283</guid>
      <dc:creator>icf_Eric_Link</dc:creator>
      <dc:date>2023-08-18T19:18:47Z</dc:date>
    </item>
  </channel>
</rss>

