Detecting duplicate information and displaying a warning message

Hello everyone, I want to ask you something about our project.

Inside our project , to register a person to an activity, we collect the id of that person and the id of the activity he participated in. However, when doing this, I want to show a warning message to end users if this participant has previously participated in an activity with the same activityid . Or how many times has this Id repeated inside this form? is it possible? Please also find a picture froım our participation form attached.

@anilgnydn, are you trying to do this without a pulldata function or the dynamic data attachment feature?

I’m already using dynamic data attachment feature for bringing other information from parent project but the ids I want to check are inside the child project. @Kal_Lam

@anilgnydn, maybe you could do it as outlined in our other post:

1 Like

As far as I understand from this information, the formula you have provided is added to the child project and counts the duplicate names inside the parent project. However, without having the child project, I want to check data in current project I am using. Is this possible ?

@anilgnydn, I have used the dynamic data attachment feature here. And this approach uses only one form where the form is both the parent form and the child form. i.e., the form is linked with the same form.

1 Like

This feature is amazing and it worked thank you @Kal_Lam much appriciated. I would kindly ask you one more thing if possible. In the example you gave, only the name column is checked for duplication, but I want to check the names, surnames, father’s name, mother’s name in the same formula, is it possible? because the name column alone is not enough for me to check duplication. Kind regards

1 Like

@anilgnydn, you could have multiple checks like the one I have created and shared.

1 Like

Yes I understand, I can write the same formula one by one for each column but I don’t want to check one by one. I want to have warning message if name, surname, father’s name and mother’s name are exactly same at the same time. İf one of them is not matching then I won’t think its duplication.

The easiest approach would be to have one expression for one check. You could, however, try with the operator, which I have not tried. Feel free to update the community your findings so that everyone would benefit.

1 Like

I tried but its not working maybe I’m puting the operators in a wrong place, I would be appreciated if you could help me to finalize this formula that I wrote in calculation column.

count(instance(‘survey’)/root/data[Name = current()/…/Name] and count(instance(‘survey’)/root/data[Surname = current()/…/Surname] and count(instance(‘survey’)/root/data[Father_Name = current()/…/Father_Name]

Hi @anilgnydn,

Anıl can you try to use 2 dots .. instead of 3? And close the parenthesis of the instance?

1 Like

Hi @hakan_cetinkaya thank you for your response, I have revised the formula as you mentioned but stil not working. Please kindly find the final version of the formula abow.

count(instance(‘survey’)/root/data[Name = current()/…/Name] ) and count(instance(‘survey’)/root/data[Surname = current()/…/Surname]) and count(instance(‘survey’)/root/data[Father_Name = current()/…/Father_Name])

If I delete the part after “and” and leave a single condition, the formula works

count(instance(‘survey’)/root/data[Name = current()/…/Name] )

@anilgnydn, Can you use three different calculation questions to see if all of them are working? Let’s see if removing the boolean operator (and) makes any difference.

1 Like

When I use 3 different calculations, the formulas work as you can see in the picture below and the attached examples. However, I want to write one single formula and check the answers of 3 questions (Name,Surname,Mother_Name), if al the information are exactly same I want to think its duplication If two of them are the same and 1 of them is different or visa versa, I will not call it as a duplication. @hakan_cetinkaya

duplication.xlsx (9.8 KB)

@anilgnydn, all right, let’s dive into the syntax for everybody :slight_smile:

Kal’s method does 3 things:

  • instance: Returns the name from the parent form (in this case the parent form and the child form are the form itself, but for the clarity, let me use that)
  • count: Gives the total count of instances (in this case, if the name is in parent form it gives 1, if the name is not in parent form it gives 0)
  • if function: Looks for the count number, I think you know how to use this one.

and is a boolean operator, in simple terms it is used with True and False results, not with numbers (which is the case in count)

So in order to triple check something, we need to think in this syntax.

I would suggest using mathematical operators with the counts, and using an IF statement to check if the total value equals to 3 or not. But in this way we are risking if there are 2 instances of a certain answer and 0 instances of another answer
(Or in mathematical terms, we are looking for 1+1+1=3 not 1+2+0=3)

I think best way is to check for each count for their value (If the value is 1 or 0).


Finally I have did something that will meet our needs many thanks for guiding me. Much appreciated. @hakan_cetinkaya


@anilgnydn Anıl, congrats. Can you share your solution in here, so other members of the community could benefit from it too?

1 Like

@anilgnydn, @hakan_cetinkaya :clap: :heart: :partying_face:

1 Like

Sorry @hakan_cetinkaya, at first it looks like it was working properly but when go it deeply I noticed that it still checks(Name,surname,mother_name,father_name) separetly not at the same time so it doesn’t give the correct result or it is not what i am looking for. Maybe you can help me develop this formula

Detecting Duplication.xlsx (9.7 KB)