<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Stefan,</p>
<p>I got it work with "aggregate()" not with "relation_aggregate()"</p>
<p>Not sure if relation_aggregate() works in both directions?</p>
<p>I also got a warning "The generated relations for a polymorphic relation cannot be used" ...</p>
<p>I have inheritance in my data model - maybe that is the cause that relation_aggregate() doesn't work, while aggregate works.</p>
<p>------------</p>
<p>Here is what works for me:</p>
<p><span style="font-family: courier new, courier, monospace;">with_variable(</span><br /><span style="font-family: courier new, courier, monospace;">  'vereinbarung',</span><br /><span style="font-family: courier new, courier, monospace;">  get_feature(</span><br /><span style="font-family: courier new, courier, monospace;">    'Vereinbarung',</span><br /><span style="font-family: courier new, courier, monospace;">    't_id',</span><br /><span style="font-family: courier new, courier, monospace;">    vereinbarung</span><br /><span style="font-family: courier new, courier, monospace;">  ),</span><br /><span style="font-family: courier new, courier, monospace;">  aggregate(</span><br /><span style="font-family: courier new, courier, monospace;">    layer:='Vereinbarung',</span><br /><span style="font-family: courier new, courier, monospace;">    aggregate:='array_agg',</span><br /><span style="font-family: courier new, courier, monospace;">    expression:=@id,</span><br /><span style="font-family: courier new, courier, monospace;">    filter:=t_id = attribute(@vereinbarung,'t_id')</span><br /><span style="font-family: courier new, courier, monospace;">    )[0]</span><br /><span style="font-family: courier new, courier, monospace;">)</span></p>
<p>'Vereinbarung' is a geometry layer in my project that is related to a no-geometry table from which I want to trigger an atlas rendering ...</p>
<p>It is a pity that a "feature" doesn't contain it's internal ID in the attributes ... it would make it much easier! No silly workarounds with aggregates to get access to an internal id ...</p>
<p>Thanks a lot for the idea with the aggregates!</p>
<p>Andreas</p>
<p><br /></p>
<p id="reply-intro">On 2022-11-29 16:54, Stefan Giese (WhereGroup) via QGIS-Developer wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div>
<p>Hi Andreas,</p>
<p>in case of a relation 1:many you can use the <em>relation_aggregate</em> function, something like:</p>
<p><em> relation_aggregate('test_n_318_fk_test1_7993_id','concatenate',</em><em> to_string(@id),',')</em></p>
<div class="v1moz-cite-prefix">where the first parameter is the ID of the relation.</div>
<div class="v1moz-cite-prefix"> </div>
<div class="v1moz-cite-prefix">Hope this helps...</div>
<div class="v1moz-cite-prefix">Stefan</div>
<div class="v1moz-cite-prefix"> </div>
<div class="v1moz-cite-prefix">Am 29.11.2022 um 15:05 schrieb Andreas Neumann via QGIS-Developer:</div>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<p>Hi,</p>
<p>I am looking for a way to find out the internal id of a related layer with a QGIS expression.</p>
<p>@id and $id only work directly on the feature of the source layer, but not on related layers.</p>
<p>attributes(<br />   get_feature(<br />      'Other Related Layer',<br />      't_id',<br />      fkey_value<br />   )<br />)</p>
<p>doesn't contain the internal id of the other layer ...</p>
<p>Any ideas how to get access to internal ids of other layers?</p>
<p>Thank you and greetings,</p>
<p>Andreas</p>
<br /><fieldset class="v1moz-mime-attachment-header"></fieldset>
<pre class="v1moz-quote-pre">_______________________________________________
QGIS-Developer mailing list
<a class="v1moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="v1moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="v1moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
</blockquote>
<pre class="v1moz-signature">-- 
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

<a class="v1moz-txt-link-abbreviated" href="mailto:stefan.giese@wheregroup.com" rel="noreferrer">stefan.giese@wheregroup.com</a>
<a class="v1moz-txt-link-abbreviated" href="http://www.wheregroup.com" target="_blank" rel="noopener noreferrer">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885</pre>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br />QGIS-Developer mailing list<br /><a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><br />List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br />Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div>
</blockquote>
<p><br /></p>

</body></html>