Hi list,https://docs.qgis.org/3.22/en/docs/user_manual/expressions/expression.html#function-editor mentions the optional keyword argument "referenced_columns" to the `@qgsfunction` decorator. It says
> referenced_columns=[list]: An array of attribute names that are required to the function. Defaults to
> [QgsFeatureRequest.ALL_ATTRIBUTES].That, and examples where it is used in other people's code, led me to believe that the feature's attributes would not be accessible unless listed in that parameter or if the parameter was omitted (-> default value getting used -> default is all attributes).
The default code that gets inserted into the editor includes the decorator `@qgsfunction(args='auto', group='Custom', referenced_columns=[])` so I'd assume that I would not be able to use any attributes in the function.
In reality I can access them just fine though, e. g. `feature["name"]` if I had features with a "name" attribute and that default `referenced_columns=[]`.
I can even do so if I used `referenced_columns=["foo", "bar"]`! `feature["name"]` is still perfectly accessible.
Is this a bug or by design? If by design, what purpose does this parameter have?
Thanks Hannes -- Johannes Kröger / GIS-Entwickler/-Berater WhereGroup GmbH Eifelstraße 7 53119 Bonn Germany Tel: +49 (0)228 / 90 90 38 - 36 Fax: +49 (0)228 / 90 90 38 - 11 [email protected] www.wheregroup.com Geschäftsführer: Olaf Knopp, Peter Stamm Amtsgericht Bonn, HRB 9885 ------------------------------- ******************************************** Where2B Konferenz 2021 16. Dezember 2021 im Universitätsclub Bonn und online https://where2b-conference.com/ ********************************************
OpenPGP_0xBF7B268A77C202D5.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
