Select to view content in your preferred language

Limit the number of new repeats in an Inbox

540
3
03-15-2024 07:52 AM
BrandonGregg
Emerging Contributor

I have a survey with nested repeats 

Plot > Seedlings > seedling visit 

When the restoration crew visits a plot (main feature) they need to visit each seedling (first repeat) and then add a record for the seedling visit (nested repeat). For the newest seedling visit I want to limit to only 1 NEW record. 

Here is what I've tried : 

Outside of the repeat I used an aggregate expression: ${repeatcount} = count(${VisitNo})+1

I then referenced that field in the repeat_count column : repeat_count=${repeatcount}

However, this constantly updates and adds new records everytime you move to the newest record. 

 

Any suggestions?

BrandonGregg_0-1710514225196.png

BrandonGregg_1-1710514258775.png

 

3 Replies
LisaRockwell1
Emerging Contributor

I think you are looking for the once() function

0 Kudos
BrandonGregg
Emerging Contributor

Where do you see that fitting in to the workflow?  How could I use the once() function to limit the amount of additional repeats permitted? 

0 Kudos
DougBrowning
MVP Esteemed Contributor

You can try once(count(${VisitNo})+1) but repeat count does not like being dynamic and may cause other issues.  What I do is just have a field with a calc of count(${a_repeat_field}) and then put a constraint on that field.  It has been much more stable for me.  It will let you create one too many but then it gets trapped.  I added a red note saying "Went too far delete this repeat" and the users have been fine with it.

Hope that helps.

0 Kudos