<div dir="ltr"><div dir="ltr">The settings are fine, the values work correctly in a dropdown list, what doesn't work is the filtering based on the value selected in the previous field. </div><div dir="ltr">It's as if current_value() doesn't return a value.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Vedran Stojnović <<a href="mailto:phidrho@gmail.com">phidrho@gmail.com</a>> ezt írta (időpont: 2025. ápr. 25., P, 8:43):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Did you set up relational widgets properly?</div><div><br></div><div>There is a good tutorial in the official docs:<br><a href="https://docs.qgis.org/3.40/en/docs/user_manual/working_with_vector/joins_relations.html#many-to-many-n-m-relations" target="_blank">https://docs.qgis.org/3.40/en/docs/user_manual/working_with_vector/joins_relations.html#many-to-many-n-m-relations</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">čet, 24. tra 2025. u 22:05 Kosza Antal via QGIS-User <<a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a>> napisao je:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">chris hermansen <<a href="mailto:clhermansen@gmail.com" target="_blank">clhermansen@gmail.com</a>> ezt írta (időpont: 2025. ápr. 24., Cs, 20:07):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Kosza and list,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 24, 2025 at 3:34 AM Kosza Antal via QGIS-User <<a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello everyone,<br><br>I want to implement the following in qgis<br><br>Given 3 geopackage tables, one is the findings, the second is the type, the third is the material, and the fourth is the findings_material. The latter is a connecting table between the type and the material. The tables refer to each other with foreign keys. The foreign key is of type uuid.<br><br>The task: in qgis, the findings table needs to be edited, the findings field refers to the type uuid with a foreign key, the material field refers to the uuid key of the material table. qgis automatically recognizes the relationships and sets up a relation reference widget.<br><br>What I want: when I select the finding, i.e. the corresponding value from the type table, in the material it should filter the values based on the pivot table.<br>This is how it looks in sql.<br><br>SELECT<br>a.uuid AS material_uuid,<br>a.values AS material_values <br>FROM<br>material AS a<br>JOIN<br>result_material AS pivot ON a.uuid = pivot.material_fk<br>WHERE<br>pivot.characteristic_fk = '6c5356d0-3257-49ed-8f95-4262d33175c9';</div><div dir="ltr"><br></div></blockquote><div>Just wondering if you could create a view based on your SELECT statement that is editable (I've not done this in SQLite so I have no idea if it's possible).</div><div><br></div>Looking at your SQL vs your description, I'm not following.  You say "the findings table needs to be edited"... Then it seems to me you need a SELECT statement like this:</div><div class="gmail_quote"><br></div><div class="gmail_quote">SELECT f.*,t.*,m.*</div><div class="gmail_quote">FROM findings AS f</div><div class="gmail_quote">JOIN type AS t ON f.type_uuid = t.uuid</div><div class="gmail_quote">JOIN material AS m ON f.material_uuid = m.uuid</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div>I don't understand the purpose of the table you call "findings_material" in one place and "result_material" in another and which you say is "a connecting table between the type and the material".  It seems to me the findings table connects type and material (as per my SELECT statement).  Are you using it to restrict the combinations of type and material?  If that's the case, then you should probably relate the findings table to that restricting table rather than type and material directly.  I would probably choose to call that restricting table something like "allowed_type_material" and have a field on findings that was called "allowed_type_material_uuid".</div><div><br></div><div>Sorry that I'm not finding your problem description clear; I hope my comments don't add confusion.</div><div><br></div></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Chris Hermansen · clhermansen "at" gmail "dot" com<br><br>C'est ma façon de parler.</div></div></div></blockquote><div><br></div><div dir="ltr">Sorry, I really worded it confusingly, the table names are in Hungarian, I overlooked something, let me clarify<br><br>The main table is the findings, in which the "type" column is a foreign key to the "uuid" column of the types table, the material column is a foreign key to the "uuid" column of the material table<br>1. table - findings<br><div>2. table - types<br>3. table - material<br>4. table - findings material (connecting table), N:M relationship<br><br>The sql query:<span style="color:rgb(80,0,80)"><br><br>SELECT<br>a.uuid AS material_uuid,<br>a.values AS material_value<br>FROM<br>material AS a<br>JOIN<br></span>findings_material AS pivot ON a.uuid = pivot.material_fk<br>WHERE<br>pivot.types_fk = '6c5356d0-3257-49ed-8f95-4262d33175c9';</div><div><br></div><div><div>All this is being done for a qfield project,. </div></div><div><br></div></div><div>I would like to solve the result of this sql query during data collection, that is, I create a point with gps, select the type of the find, and in the material column, only those values are displayed that are assigned to this type in the connection table. </div></div></div>
_______________________________________________<br>
QGIS-User mailing list<br>
<a href="mailto:QGIS-User@lists.osgeo.org" target="_blank">QGIS-User@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Srdačan pozdrav / Kind regards,<div>Vedran Stojnović.</div></div></div>
</blockquote></div></div>