<?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: Math calculation in IF Statement - Web Forms in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088382#M36440</link>
    <description>&lt;P&gt;Thanks for your help, Jim! That resolved my issues.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Aug 2021 13:27:17 GMT</pubDate>
    <dc:creator>RuchiraWelikala2</dc:creator>
    <dc:date>2021-08-12T13:27:17Z</dc:date>
    <item>
      <title>Math calculation in IF Statement - Web Forms</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088053#M36425</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to set a date field based on an answer to an earlier question on my form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the answer to the earlier question is "Yes" then, the date should be set it to 14 days from todays today.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this, I perform the following calculation on my date field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if(${urgent_yesno} = 'Yes',today()+(14*24*60*60*1000),'')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works great in Desktop but does not work with the Web Forms. Is there something that I'm missing in the syntax? When I use just today() and omit the (14*24*60*60*1000), it sets the date okay. Seems to me it's the asthmatic that's messing up the statement.&lt;/P&gt;&lt;P&gt;I also tried the below. That also works with desktop but not the web form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if(selected(${urgent_yesno},'Yes'), today() + 14*24*60*60*1000, '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if anyone can provide some guidance on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ruchira&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 18:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088053#M36425</guid>
      <dc:creator>RuchiraWelikala2</dc:creator>
      <dc:date>2021-08-11T18:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Math calculation in IF Statement - Web Forms</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088256#M36433</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/252457"&gt;@RuchiraWelikala2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Survey123 web app only supports &lt;EM&gt;decimal&lt;/EM&gt; time, while the field app supports both decimal time and epoch/UNIX time. To ensure your date/time calculations work in the web app, you must use decimal time.&lt;/P&gt;&lt;P&gt;The &lt;EM&gt;decimal-date-time()&lt;/EM&gt; function will convert a date/time to decimal date/time. So your expression could look something like:&lt;/P&gt;&lt;PRE&gt;if(${urgent_yesno} = 'Yes', date(decimal-date-time(now()) + 14), '')&lt;/PRE&gt;&lt;P&gt;Note the &lt;EM&gt;date()&lt;/EM&gt; function is also used here, to treat the whole thing as a date/time object.&lt;/P&gt;&lt;P&gt;Please see the&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528" target="_self"&gt;Dates and Time in Survey123&lt;/A&gt; blog post and the &lt;A href="https://doc.arcgis.com/en/survey123/desktop/create-surveys/decimaldatetime.htm" target="_self"&gt;Decimal date time&lt;/A&gt; documentation for more information.&lt;/P&gt;&lt;P&gt;Hope this helps! Best, Jim&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 04:03:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088256#M36433</guid>
      <dc:creator>Jim-Moore</dc:creator>
      <dc:date>2021-08-12T04:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Math calculation in IF Statement - Web Forms</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088382#M36440</link>
      <description>&lt;P&gt;Thanks for your help, Jim! That resolved my issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 13:27:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/math-calculation-in-if-statement-web-forms/m-p/1088382#M36440</guid>
      <dc:creator>RuchiraWelikala2</dc:creator>
      <dc:date>2021-08-12T13:27:17Z</dc:date>
    </item>
  </channel>
</rss>

