Topic: How to add custom attribute to report output
I am trying (and failing) to do something simple...
I need to add a custom attribute - Observation type - to a report grid output. I've been referring to this page for guidance: http://indicia-docs.readthedocs.io/en/l … butes.html
The last bit of text on that page says " If you don’t already have any custom attributes configured for one of the surveys accessible to your client website then this would be a good time to configure one. You can then try specifying the custom attribute using the ID or attribute caption in the parameter to check it works." I do have custom attributes configured but I am not sure how to refer to them correctly. There is not an example of "specifying the custom attribute using the ID or attribute caption in the parameter".
This is what I have tried:
I think I need to add a join to the occurrence_attribute_value table like this "LEFT JOIN occurrence_attribute_values v on o.id = v.occurrence_id" and then I can show the occurrence_attribute_id and int_value in the report. That works but there are duplicates. See attached file.
There are several custom attributes for this survey e.g. Observation type [id=7], Age-sex breakdown (Adult males , adult females etc). Where do I specify that I only want to see attributes from "Observation type" (occurrence_attribute_id=7)? If I put it in the query (i.e. WHERE #sharing_filter# and v.occurrence_attribute_id=7) then of course it only shows records where the Observation type was recorded, and not those records where the Observation type was left blank. And the next step would be - how do I get it to show the Observation type text (sighting, road kill etc) rather than the number? I can do all of this in an Access query (in attached file) but, firstly, I don't know how to reproduce this in the report query and, secondly, I think I am missing an obvious step somewhere which means I shouldn't have to do this.
Please see the attached file for clarity.
(I am still using cache_occurrences but I don't think this makes any difference here.)
Thanks for any help!