AnsweredAssumed Answered

When If Statement is False Keep Existing Value

Question asked by shepardb on Aug 2, 2018
Latest reply on Aug 2, 2018 by JTedrick-esristaff

The background gets pretty involved, but I can provide more information if it's helpful.  What I'm trying to do is:

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.

 

We have several QR Codes, each one representing a unique URL.  I want to know how many QR codes have been scanned during a survey.  A barcode question populates ${QrCode} when it's scanned.  I have a hidden (bind::type = integer) question specific to each unique URL that is defaulted to 0.  If ${QrCode} = one of the URLs, the specific question related to that URL should change from 0 to 1.  That works fine, but if another URL is scanned the previous question whose value changed to 1 changes back to 0.  Is there a way to have a question default to 0, change to 1 upon a certain condition, and then remain that value?

 

Barcode question populates ${QrCode} with a URL

Hidden integer question (${QrCodeVisit1}) defaults to 0, calculation is: if(${QrCode}="URL1",1,0)

If ${QrCode} = "URL1", then ${QrCodeVisit1} = 1

If another barcode is scanned and ${QrCode} = "URL2", then ${QrCodeVisit1} reverts to 0.  I'd like that 1 to persist.

 

I tried if(${QrCode}="URL1",1,${QrCodeVisit1}), but I get an error.  Is there any way to specify the result of an if statement to just not do anything?

 

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.

Outcomes