<?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 When If Statement is False Keep Existing Value in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/when-if-statement-is-false-keep-existing-value/m-p/835706#M19561</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The background gets pretty involved, but I can provide more information if it's helpful.&amp;nbsp; What I'm trying to do is:&lt;/P&gt;&lt;P&gt;Set the value of a hidden (bind::type = integer) question if a condition is met, and if the condition is not met keep it's existing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have several QR Codes, each one representing a unique URL.&amp;nbsp; I want to know how many QR codes have been scanned during a survey.&amp;nbsp; A barcode question populates ${QrCode} when it's scanned.&amp;nbsp; I have a hidden (&lt;SPAN&gt;bind::type = integer) question specific to each unique URL that is defaulted to 0.&amp;nbsp; If ${QrCode} = one of the URLs, the specific question related to that URL should change from 0 to 1.&amp;nbsp; That works fine, but if another URL is scanned the previous question whose value changed to 1 changes back to 0.&amp;nbsp; Is there a way to have a question default to 0, change to 1 upon a certain condition, and then remain that value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Barcode question populates ${QrCode} with a URL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hidden integer question (${QrCodeVisit1}) defaults to 0, calculation is:&amp;nbsp;if(${QrCode}="URL1",1,0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If ${QrCode} = "URL1", then ${QrCodeVisit1} = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If another barcode is scanned and ${QrCode} = "URL2", then ${QrCodeVisit1} reverts to 0.&amp;nbsp; I'd like that 1 to persist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried&amp;nbsp;if(${QrCode}="URL1",1,${QrCodeVisit1}), but I get an error.&amp;nbsp; Is there any way to specify the result of an if statement to just not do anything?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm not totally positive my grand plan is going to work out, but if I get this resolved I'll be a little further down the path.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Aug 2018 21:58:14 GMT</pubDate>
    <dc:creator>bshepard</dc:creator>
    <dc:date>2018-08-02T21:58:14Z</dc:date>
    <item>
      <title>When If Statement is False Keep Existing Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/when-if-statement-is-false-keep-existing-value/m-p/835706#M19561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The background gets pretty involved, but I can provide more information if it's helpful.&amp;nbsp; What I'm trying to do is:&lt;/P&gt;&lt;P&gt;Set the value of a hidden (bind::type = integer) question if a condition is met, and if the condition is not met keep it's existing value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have several QR Codes, each one representing a unique URL.&amp;nbsp; I want to know how many QR codes have been scanned during a survey.&amp;nbsp; A barcode question populates ${QrCode} when it's scanned.&amp;nbsp; I have a hidden (&lt;SPAN&gt;bind::type = integer) question specific to each unique URL that is defaulted to 0.&amp;nbsp; If ${QrCode} = one of the URLs, the specific question related to that URL should change from 0 to 1.&amp;nbsp; That works fine, but if another URL is scanned the previous question whose value changed to 1 changes back to 0.&amp;nbsp; Is there a way to have a question default to 0, change to 1 upon a certain condition, and then remain that value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Barcode question populates ${QrCode} with a URL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hidden integer question (${QrCodeVisit1}) defaults to 0, calculation is:&amp;nbsp;if(${QrCode}="URL1",1,0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If ${QrCode} = "URL1", then ${QrCodeVisit1} = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If another barcode is scanned and ${QrCode} = "URL2", then ${QrCodeVisit1} reverts to 0.&amp;nbsp; I'd like that 1 to persist.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried&amp;nbsp;if(${QrCode}="URL1",1,${QrCodeVisit1}), but I get an error.&amp;nbsp; Is there any way to specify the result of an if statement to just not do anything?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm not totally positive my grand plan is going to work out, but if I get this resolved I'll be a little further down the path.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2018 21:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/when-if-statement-is-false-keep-existing-value/m-p/835706#M19561</guid>
      <dc:creator>bshepard</dc:creator>
      <dc:date>2018-08-02T21:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: When If Statement is False Keep Existing Value</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/when-if-statement-is-false-keep-existing-value/m-p/835707#M19562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;Depending on the range of values that could be calculated, you might want to include a self-check in the if statement sequence:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;if (. != 0, ., &amp;lt;insert URL lookup if sequence&amp;gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;This would first check to see if the value has been moved off of the default; if it has, it would retain the existing value; otherwise perform the URL lookup/assignment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, this causes a circular reference in form validation so it does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2018 22:23:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/when-if-statement-is-false-keep-existing-value/m-p/835707#M19562</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2018-08-02T22:23:05Z</dc:date>
    </item>
  </channel>
</rss>

