Survey123 calculations not working in edit mode

1305
5
04-09-2021 08:57 PM
KimberlyMcCallum
New Contributor III

Hi All, 

I am using the embed widget in Experience Builder to embed surveys so that I can click on a map feature and open a survey built on the service (in edit mode). Basically, I adapted this example of a QA/QC workflow using a Dashboard to Experience Builder (https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-embedding-a-survey...). This just uses the URL parameters and the Global ID to open the survey for editing. The app and survey looks great and I am able to submit data BUT the calculations are not working in the embedded survey! 

After some investigation, I have figured out that the issue seems to be with calculations in edit mode. The calculations work for new records; however, when I open an existing record to update it (in edit mode), I see the 'Recalculate' button; however it does not work! 

Admittedly, the calculation is a bit complicated and awkward as I'm trying to calculate Risk from a risk matrix (see screenshot). Here is the calculation: 

 

if(((selected(${DamageOrLossProbability},'VeryLikely') and selected(${ConsequenceMagnitude},'Major')) or 
    (selected(${DamageOrLossProbability},'VeryLikely') and selected(${ConsequenceMagnitude},'Moderate')) 
    or (selected(${DamageOrLossProbability},'Likely') and selected(${ConsequenceMagnitude},'Major'))), 
    'VeryHigh', if(((selected(${DamageOrLossProbability},'Likely') and selected(${ConsequenceMagnitude},'Moderate')) or 
    ((selected(${DamageOrLossProbability},'Possible')) and selected(${ConsequenceMagnitude},'Major'))), 
    'High', if(((selected(${DamageOrLossProbability},'Unlikely') and selected(${ConsequenceMagnitude},'Major')) or 
    (selected(${DamageOrLossProbability},'Possible') and selected(${ConsequenceMagnitude},'Moderate'))), 'Intermediate', 
    if(((selected(${DamageOrLossProbability},'VeryLikely') and selected(${ConsequenceMagnitude},'Minor')) or 
    (selected(${DamageOrLossProbability},'Likely') and selected(${ConsequenceMagnitude},'Minor')) or 
    (selected(${DamageOrLossProbability},'Possible') and selected(${ConsequenceMagnitude},'Minor'))) or 
    (selected(${DamageOrLossProbability},'Unlikely') and selected(${ConsequenceMagnitude},'Moderate')), 'Low', 'VeryLow'))))

 

Thanks in advance,

Kim

5 Replies
AndrewBowne
Occasional Contributor III

I have had the same problem.   I contacted support and they logged it as a bug.  BUG-000137725

It's current status is "Under Consideration"

KimberlyMcCallum
New Contributor III

Thanks for letting me know! I hope this gets resolved soon as this functionality is really important for us. Do you know how one tracks known bugs like these? 

0 Kudos
KimberlyMcCallum
New Contributor III

Were you able to come up with a workaround for this BUG? Seems like it's still not fixed and I'm afraid I am going to have to get creative to find a way to update the calculations (maybe using a JavaScript and the ArcGIS REST API) but I was curious to learn if you had any ideas before I go down the rabbit hole. 

JasminePrater
New Contributor III

You may have solved this issue already, but I encountered something similar today, although the opposite.  Perhaps my solution will work for you.  I created the survey in Survey123 Connect, and had the fields set to read-only in the XLS.  Those fields automatically calculated whenever I opened an existing survey in the widget.  However, when I removed the read-only status for those fields, I was able to retain the original values (e.g., Work Order ID) in the existing survey.  Perhaps, if you make those fields read-only, the calculations will automatically update.  If you want them to update only when the button is pushed, I'm not sure it will work, but this might be an option.

0 Kudos
AndrewE
New Contributor III

Thanks for the tip, setting it to read only fixed my recalculate issues I was having in my repeats.