CO Query Returns Same Values for Taxon and Preferred Taxon Fields

Hi Emmy!

You are correct in that the issue is related to the Query Builder rather than your data. This is a bug related to issue #8560 on GitHub. I left a comment on the issue to let the developers know you encountered it! The bug leads to unexpected behaviors, like what you’ve described, when a query includes tree rank mappings through multiple relationships such as Taxon and Preferred Taxon. It was fixed in 7.12.1.1, but the resolution introduced more critical issues involving the query builder, so it was reversed in 7.12.1.2. I will explain a potential workaround for your query, but it may or may not be valuable for your use case since it changes how the results are organized.

The inclusion of a tree rank is what causes the problem, so it will not occur if you exclude ranks from the query. You can try using the (any rank), Parent, and Child relationships instead. Rather than searching for related records in a certain rank, the Parent and Child relationships search directly for the parent or child of the Taxon record used in the determination. Then, you can search for the parent of the parent, and so on, to search as far up the taxon tree as you want.


Import this query:
Show preferred and synonym.json (4.8 KB)

Keep in mind that since the Parent/Child relationships depend on the rank directly above/below the Taxon used in the determination rather than the rank defined in the query, the values in those columns will not always belong to the same rank. In the image below, record 000043577 is determined to a record at the Genus level. Record 000043578 is determined to a record at the Subspecies level. You can use the treeDefItem relationship to show you the rank name if needed, as shown in the image below.


Import this query:
Show preferred and synonym with rank name.json (8.6 KB)
Note: I turned off localized field labels for this query so you can see the schema names of the fields and relationships. Due to a bug, the treeDefItem column name appears as $-any in the query results.

I hope this helps! Please let me know if anything needs clarification.

Best,
Lexi