[QGIS-Developer] QGIS expression to get internal ID of a feature in a related layer

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Tue Nov 29 07:54:00 PST 2022


Hi Andreas,

in case of a relation 1:many you can use the /relation_aggregate/ 
function, something like:

/ relation_aggregate('test_n_318_fk_test1_7993_id','concatenate',//to_string(@id),',')/

where the first parameter is the ID of the relation.

Hope this helps...
Stefan

Am 29.11.2022 um 15:05 schrieb Andreas Neumann via QGIS-Developer:
>
> Hi,
>
> I am looking for a way to find out the internal id of a related layer 
> with a QGIS expression.
>
> @id and $id only work directly on the feature of the source layer, but 
> not on related layers.
>
> attributes(
>    get_feature(
>       'Other Related Layer',
>       't_id',
>       fkey_value
>    )
> )
>
> doesn't contain the internal id of the other layer ...
>
> Any ideas how to get access to internal ids of other layers?
>
> Thank you and greetings,
>
> Andreas
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
----------------------
Where2B Konferenz 2022
15. Dezember 2022 in Bonn und Online
where2b-conference.com
-----------------------
WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany

Tel.: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20221129/72098b6b/attachment.htm>


More information about the QGIS-Developer mailing list