Calculations in a repeat group

Am creating a tool to monitor a few sites. If variable meets the criteria , i want, there is a calculation that determines the site as High risk, medium Risk or Low risk

I however have a repeat group and am failing to compute risk leve inside the
repeat group for number of times equal to the number of people the enumerator will interview at each site. Specific questions need to be evaluated inside the repeat, then i can combine the risk level from the repeat to the calculation outside the repeat.

Here is what i tried

Inside Repeat: once(if( ${d_hh_pay}= 1 or ${HHFraudConcerns} = 1 or ${HHAsstSecurity} = 1 or ${market_diversion}=1 or ${Pay_ent}= 1 , "High Risk", if(${HHAsstPayTrsp}= 1 or ${Received_Ass} = 0 or ${HHDTPTimeWalk} = 3 or ${HHDTPTimeWalk} = 4 or ${HHAsstTrvlDay} = 0 or ${corr_ent} = 0 or ${HHAsstKnowEnt} = 0 or ${HHAsstRecInfo} = 0 or ${HHAsstKnowPeople} = 0 , "Medium Risk ","Low Risk")))

Oustide repeat: if(${HHAsstKnowFreq}= 0 or ${sale_traders}= 1 or ${MOFraudConcerns}= 1 or ${sale_traders} = 1 or ${MOAsstArmed} = 1 or ${MOFraudConcerns} = 1 or ${p_diverting} = 1 or ${repeat_risk} = "High Risk" , "High Risk", if(${HHDTPTimely}= 1 or ${repeat_risk} = "Medium Risk" , "Medium Risk","Low Risk"))

After using these calculations, i found out the repeat was evaluating the risk level for only the last interviewed person.

seeking support on how best i can implement the repeat part to evaluate for everyone interviewed.

Even if 10 people are interviewed, but one answered triggered High risk, i want the tool to evaulate as High risk inside the repeat

Hi @Dan_Niwahereza ! :waving_hand:

Welcome to the ODK community! Whenever you get a chance, do introduce yourself here - we'd love to get to know you better! :smiling_face:

Now, coming to your query:
It's important to note that any variable inside a repeat group is often treated as a "nodeset" (since it holds multiple values - for example, if you interview 10 people, each variable in the repeat group might have 10 different values, right?).

That said, it’s a bit tricky to provide specific solution without seeing your XLSForm or form design. If you’re comfortable sharing it, please feel free to! For now, here's what I can suggest based on the info provided:

  • Take a look at the use-case and functionality of indexed-repeat (check this as well), as it might be what you need. It helps when you need to work with specific values (like performing calculations) outside the repeat group for individuals recorded within the first repeat group. (That being said, I’m not entirely sure if it’s required in your case or if simply moving what’s outside the repeat group into the first repeat group might solve the issue.)

Hope this helps! Have a great day! :smile: