[Qgis-user] Cross layer filtering

Paul Wittle paul.wittle at dorsetcouncil.gov.uk
Thu Mar 28 06:39:58 PDT 2024


Hi,

I've been filtering a layer by adding a virtual column populated with is_selected() and then creating a virtual layer from it using the filter:
WHERE virtualField = 1

This is working well and allows you to have a copy of the layer that only shows the selected records when you are creating a layout.

I now need to bring in an associated layer, but I can't find a reliable way to cross layer filter because QGIS just hangs for ages and crashes.

I've searched around and can see a lot of people talk about making the database do the work but of course it can't if you are trying to use a selection filter.

What is the most reliable way of setting up a filter based on a join because QGIS tells me that I must use a virtual layer and even creates it for me; but then it just hangs and crashes.

Is there a better way?

Info required to replicate:

  *   Create a layer (mine is from Oracle DB) and add a virtual field called "SelectedRow" with the formula "to_int(is_selected())"
  *   Bring in a second layer that has a one-to-many relationship based on an attribute
  *   I'm trying to filter the second layer based on the first one where the second layer must only include rows that match a selected key.

Thank in advance for any tips,
Paul
This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. It may contain unclassified but sensitive or protectively marked material and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All traffic may be subject to recording and/or monitoring in accordance with relevant legislation. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Dorset Council. Dorset Council does not accept service of documents by fax or other electronic means. Virus checking: Whilst all reasonable steps have been taken to ensure that this electronic communication and its attachments whether encoded, encrypted or otherwise supplied are free from computer viruses, Dorset Council accepts no liability in respect of any loss, cost, damage or expense suffered as a result of accessing this message or any of its attachments. For information on how Dorset Council processes your information, please see www.dorsetcouncil.gov.uk/data-protection
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240328/b6cbdb6b/attachment-0001.htm>


More information about the QGIS-User mailing list