Is it possible to alert the user of the duplicate records

Agree with @elmps2018.

Also you might need to design the behavior into the form to help steer the user to fix the problem if not obvious to the user what to do. I often use an “if” with a prompt that explains what to do if the constraint check is invalid.

1 Like

Many thanks @elmps2018 and @W_Brunette
Have followed as example given by @elmps2018 but still having duplicates
Any other example help with be much appreciated

pdemo.xlsx (13.6 KB)

The latest form you shared doesn’t seem to have any constraints. Without the constraint it will allow duplicates. Simply counting the number of forms (which is what the form currently does), does not prevent having multiple forms. I know you were having problems with the constraint always binding. What do you see for that variable in tables?

Many thanks. pdemo.xlsx (13.6 KB) I did remove the constraint because it was preventing me from proceeding.
The variable records nothing in the table

Exactly. My headache is with the constraint binding

If nothing is recorded in the table for the count_pid variable, then there must be an issue somewhere with that getting created, that’s why the constraint always binds. It looks like for one problem you are missing the prompt_types tab and there may also be an issue with your customPromptTypes.js file. Please review the customizing prompts section here: Using ODK-X XLSX Converter — ODK-X Docs and make sure you have all those pieces in place.

Hello Team,
Am still stuck with this, who has another code we try out.
Have tried as advised by @elmps2018 and am still stuck
Any help I will appreciate

If you can share your current .xlsx and customPromptTypes.js file that will help folks identify the issue.

Many thanks again @elmps2018
Attached are the files
pdemo_refined.xlsx (29.4 KB)
customPromptTypes.txt.zip (2.1 KB)

So a few things:

  1. check_pid, the variable you are using to constrain, is not in your model statement (tab). It won’t exist in your table as a result, and therefore can never be 1. It needs to be added to your model statement, and defined as a type (integer) that is compatible with async_assign_count. It may be helpful to review the Customizing prompts/async_assign section here: Using ODK-X XLSX Converter — ODK-X Docs where it reviews the need to update your model statement.

  2. It looks like you are querying a different form, CBS_Case_Report, that is not referenced anywhere else, so the problem could be coming from an issue in that form. If #1 doesn’t solve problems please share this form as well.

  3. Another problem is that you did not update the path to be to your form in the custompromptstypes file. It still says my: templatePath: ‘…/config/tables/quest1_02_0/forms/quest1_02_0/templates/async_assign.handlebars’,
    You can use the one here: Using ODK-X XLSX Converter — ODK-X Docs to automatically get the table or update the quest1_02_0 to pdemo

1 Like

Many thanks @elmps2018
Am able to follow your guidance and am now getting somewhere. Now am getting undefined field after the check_pid that wont allow me procede until I insert 1.It should count and store in the database the value rather than allow the user to insert a value to it
Many thanks once again
Am I referencing this correctly. I have a unique identify pid and am using async-assign-count on another variable check_pid which again constraints

1 Like

Many thanks @W_Brunette.
Do you have a sample that is able to do this?
If you do please share

1 Like

Hi @hissdev! If I am understanding correctly, you are getting an undefined field after the check_pid – do you mean you are having this as a field someone can enter data into on your form? That’s a good way to test, but you would not want to implement the check this way in the field. Yes, it should count and store in the database the value. If it is not there is likely an issue with the query, async_assign, or templatePath

@hissdev check out:

Hi, @elmps2018
I have one query. I want to restrict the duplicate personal identification number in the ODK central.
If I have entered a record with the PID 123 and after submitting the first record again I want to enter the another record with same PID as 123, then it should restrict me that same I’d record already exists. Without media file. It will search directly from the server

Hi @Shamsher_Singh! ODK Central is managed by ODK and their help forum is here: https://forum.getodk.org/

Have tried as advised by @elmps2018 and am still stuck

Hi @manetied! Can you explain more what you tried and the problems you encountered?

I want to restrict the duplicate personal identification number in the ODK central...

This is forum for ODK-X, for issues with ODK central, please use the ODK forum: https://forum.getodk.org/

1 Like