We have data that matches some of the predefined labels that are groups in the system, but when we import the data it creates a new FIELD_VALUE instead of using the predefined one. Nothing breaks until I try and group things. When I tried to group F as Female it made an entry in the FIELD_VALUE_GROUP table with 51981 as the PARENT_ID instead of 48 as the PARENT_ID. Manually changing this in the DB fixes the problem.
I don’t know if the problem is that our import with Female is creating a new FIELD_VALUE (51981) instead of using the existing FIELD_VALUE (48), or if the problem is with the Grouping feature picking the wrong PARENT_ID of the the two entries with a label of Female.
I can recreate this if anyone wants to see it.
MariaDB [emerse]> select *, cast(is_group as int) from FIELD_VALUE where FIELD_ID = 8;
±------±---------±---------±-------------±--------±----------------------+
| ID | FIELD_ID | IS_GROUP | LABEL | COUNT | cast(is_group as int) |
±------±---------±---------±-------------±--------±----------------------+
| 51985 | 8 | | *Unspecified | 103 | 0 |
| 45 | 8 | | F | 0 | 0 |
| 51981 | 8 | | Female | 6289184 | 0 |
| 46 | 8 | | M | 0 | 0 |
| 51982 | 8 | | Male | 5198652 | 0 |
| 51984 | 8 | | Nonbinary | 422 | 0 |
| 47 | 8 | | U | 0 | 0 |
| 51983 | 8 | | Unknown | 7329 | 0 |
| 48 | 8 | | Female | 0 | 1 |
| 49 | 8 | | Male | 0 | 1 |
| 50 | 8 | | Unknown | 0 | 1 |
±------±---------±---------±-------------±--------±----------------------+