Select to view content in your preferred language

Repeatable calculation occasionally not executing

60
1
8 hours ago
Andy_CS
New Contributor III

I have a calculation type question (ccTotalTrees) inside a S123 repeatable that returns a value of 1 or an integer from another response (crUninfestedTrees, which cannot be left blank) depending on the survey type.

For one user the calculation is not always executing, when it doesn't the field value is set to null. It's only happening for one user out of about 60 and I cannot figure out why. They are using the same, current, S123 version as other users.

The calculation mode is set to always.

Just wondering if anyone has any ideas, as I am stumped. I was wondering if the problem was caused by them switching survey types from infested to uninfested before submitting.

typenamerelevantcalculation
select_one SurveyTypeprSurveyType  
begin repeatrsTrees  
integercrUninfestedTrees${prSurveyType}='uninfested' 

calculate

ccInfestedTrees${prSurveyType}='infested'if(selected(${prSurveyType},'infested'),1,0)
calculateccTotalTrees if(selected(${prSurveyType},'infested'),1,${crUninfestedTrees})
end repeatrsTrees  
0 Kudos
1 Reply
DougBrowning
MVP Esteemed Contributor

I wrote an answer then realized it is not what I thought.  Not sure the outcome you want here.  You are counting uninfested but if they see any infested at all then ccTotalTrees gets a 1?  I would think you would count both and have two diff totals then a master total.  Sorry not sure the workflow here.

If it is a total or 1 thing I would just remove the relevant from ccInfestedTrees.  You always want that to have a value here - a 1 or a 0.  Relevant can fire in the wrong order which gives ccInfestedTrees a value of "" which then breaks TotalTrees.  If you really want ccInfestedTrees to be blank if no infested trees I would just do if(selected(${prSurveyType},'infested'),1,"")  But to me having a zero makes more sense.

I was assuming you wanted a sum across all repeats.  That would be a sum(total) outside of the repeat.

Sorry but hard to follow but try that.

 

0 Kudos