Select to view content in your preferred language

How to Prevent Duplicate Submissions per Period Using Reference_FarmID in Survey123 Connect

482
10
Jump to solution
2 weeks ago
hmorgan
Emerging Contributor

Hello everyone,

I am creating a survey in Survey123 Connect where I need to prevent duplicate submissions for the same farm within the same quarter.

In my survey, I have the following fields:

  • Reference_FarmID (text input)

  • submission_quarter (calculate)

  • submission_year (calculate)

My goal is to ensure that each Reference_FarmID can only be submitted once per quarter. If a record for the same farm has already been submitted in the same quarter and year, the form should block the second

The issue is that no data exists yet in the feature layer, but the form is already restricting me and treating it as a duplicate. It will not allow the very first submission.

How can I correctly configure the duplicate check so that:

  • The first-ever submission is allowed

  • Only the second submission in the same quarter is blocked

submission.

type name label calculation constraint constraint_message

textReference_FarmIDFarm Reference ID count(pulldata("@layer", "Reference_FarmID", "Reference_FarmID", ., "submission_quarter", ${submission_quarter}, "submission_year", ${submission_year})) = 0This Farm ID already submitted in ${submission_quarter} ${submission_year}
calculatesubmission_quarter if(format-date(now(), '%m') <= 3, 'Q1', if(format-date(now(), '%m') <= 6, 'Q2', if(format-date(now(), '%m') <= 9, 'Q3', 'Q4')))  
calculatesubmission_year format-date(now(), '%Y')  
0 Kudos
10 Replies
hmorgan
Emerging Contributor

@Neal_t_k   Thank you for your assistance, it worked perfectly well

0 Kudos