Hey all - This is usually a sign that your database somehow ended up with several categorycombinations named ‘default’:
select * from categorycombo where name = ‘default’;
Hopefully only one of the categorycombos are being used, and the others can be deleted or renamed. This job requires a bit of dhis2 database knowledge, and it is important to test the approach on a database copy, or at least keep a backup.
If any categorycombos are completely unused, a simple delete SQL will remove them. If you are lucky, all but one of the categorycombos can be deleted. As long as your database has the normal foreign key constraints defined, you could try and delete the categorycombos named ‘default’ one by one - and the foreign key constraint would prevent you from deleting the ‘default’ categor(ies) that is used in your database.
In case multiple categorycombos with the default name that cannot be deleted, the job becomes a bit more involved - but let us see if this problem is in your database before trying to solve it.
Delete failed on categorycombo table
Complained about foreign key on categorycombos_categories
Then traced the relationship between the two, and deleted referenced ID in second table
Delete failed again on categorycombo table
Complained about foreign key on categorycombos_optioncombos
Then traced the relationship between the 2 tables, then deleted referenced ID in this table. But failed due to referenced ID in dataapproval table.
That is when I checked if I am still having a problem, then boom! Problem solved.!!!
So, problem was solved by deleting ‘default’ id on categorycombos_categories table.
@Gassim while @mmpeete 's solution solves the capture problem it creates a similar problem for the aggregate side “data entry”. when we check the database back before the “default” categoryCombos_categories was deleted we actually had just one “default”. we started experiencing this problem when upgraded from version 2.30 >> 2.31 >>2.32 >> 2.33 >> 2.34 >>2.35 (where we currently are).
I have one default and the issue still persists. Perhaps I have to dig a little bit deeper.
According to @moeketse if I delete this only default, It will resolve the capture and create the aggregate problem because the datasets depend on this default combo. Am I right?
I hope it doesn’t cause issues as you said because I believe while deleting we’re deleting the unused category combinations and relaying on the foreign key constraints to keep us from deleting ‘default’ categor(ies) that are being used.
@moses_mwale it seems that this solution is only for when :
So if you have only one categorycombination named ‘default’ then you are right maybe there’s a different approach? @Markus
Hello @moses_mwale. can you check , from app levell, how many "default"s do you have in Category Option combiniation. I had 3 of them. If you have more than 1, you may need to get into database and find a way to delete 2 that are not linked to other tables (especially datavalue). Mr @moeketse is right, if you manage to delete default in categorycombo table, you probably going to encounter problems. That is why we need to use dev/test db and instance.
Hello @mmpeete
this worked for me, I overlooked the frontend check. I found 4 of the catoptcombo. After deleting the 3 and remained with one. Event capture worked and aggregated entry worked too. Thank you.
You are welcome. Let us also wait for the reporting circle to complete. Then we shall be sure that this is 100% solution if no users luanch complaints.
I have this error when I launch the event from my tracker … how will he fix it
this error is : “Erreur dans la création de l’évènement
Incorrect result size: expected 1, actual 2”
May you please share screenshots of the issue with the Network tab, and if it’s possible share the Tomcat log (without including sensitive info)? You might also try to clear the browser cache, and use the Data Administration app to make sure you don’t have any issues with your database. Thanks!
Please also include the version of the DHIS2 instance that you are using. (:
We can ask the developers for support but we need to give them more info to understand the situation.
Please what is the version of the DHIS2 instance that you are using? And would you please take a screenshot of the Network tab (F12 → Network) see if there’s a red line and click on it and take a screenshot. Thank you!
Okay, I searched in the previous CoP posts, and found this topic which is exactly the same as the issue you are facing so I will move this topic. I know you said you are not admin in the server but to solve this issue you will probably need access to the database. Please read the instructions by @Markus and see if it solves the issue: