Duplicate Records - Advice


Just wondered if anyone could advise.

I create an abstracted Questionairre in my app with Yes/No answers.

Two workflows:

  1. Search if an answer to that question exists for the assessment and if so worflow to find and modify the record.
  2. A second workflow, which is the opposite and adds the record if it doesnt exist in the answer table.

Problem arose today when somehow there were two answers to the same question, which I can only suspect means that the user clicked yes, then no before the first script had created the record. It can only be one user, as it was in testing.

How can that be? I can only assume that the workflow can be run twice prior to the first record being saved.

Is there a way that some belt and braces can be added to prevent this from happening?

Simple. Make conditional when someone click yes set state yesno to be yes and on No button when state yesno is yes hide it! And vice versa…

Hide other button when someone clicks one they choose!
Until new question is on the screen.

Thanks Igor,
All the questions are in a repeating group.
I am still perplexed and just staring at the data and the logs.

Its the only time its happened, in weeks of testing and only revealed because the questions answered was one over the questions total.

The problem is that its a scoring system for a complex report.

As you will see from my data and my workflows the DB created two records. Looking at the logs 8ms apart, with the same question ID, even though the search on the workflow prohibits it, as it would find the record and therefore modify.

The only thing I can think of is that there was a glitch in the saving of the first record so when the search was run it wasnt already saved the second time.

DBs should work like that!! I guess my only way around it would be to run a final search for duplicate records before completing, and then delete the one created first!!! Feels very messy and lacking integrity.

Those two UUIDs in the middle of the picture are the question UUIDs and therefore should never exist together, as the workflow prevents it.

Maybe set a state with the UUID of the last question UUID a record was created on, and add that to the search??? to prevent a new record being created as well as the search. forcing it down the Edit record route!

It feels like a DB writing timing issue. Those workflows have been triggered 900 times in testing and this is the only time it has created a duplicate record.

I tried to reproduce, but cant!
Screenshot 2024-04-02 at 23.18.49