Feature request #16040

Filter relation reference widget by expressions

Added by Regis Haubourg almost 8 years ago. Updated over 7 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Forms
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:23955

Description

Relation reference widget does not allow to spatially filter potential related features. (that widget [[https://issues.qgis.org/attachments/9427/emeded_form_relationreferenz.jpg]] )

Filtering by expression instead of simple fields would allow to call functions such as

 intersects(  $geometry ,  geomFromWKT( $current_canvas_extent ))

That would allow a dropdown list reduced to a few neighbouring features. Currently it loads the whole layer, and can kill QGIS.

a native checkbox to filter by canvas would be also good for average users


Related issues

Related to QGIS Application - Bug report #10900: python filter expression don't work on "value relation" Closed 2014-07-16

History

#1 Updated by Regis Haubourg almost 8 years ago

For the record, it is possible in value relation widget . See #10900
but that one can not allow user to click on a map object.

#2 Updated by Matthias Kuhn almost 8 years ago

I would propose to solve this on a broader perspective (i.e. not only for the relation reference widget) and introduce a new "search feature(s)" widget that allows for searching features based on attributes or location. This widget would be opened with a separate button (like the select from canvas button now).

The combobox on the other hand shouldn't load all the options (if there are more than ~100 there is no longer any point in doing so) but have an autocompleter that works with requests on the data source and proposes matches based on this.

#3 Updated by Regis Haubourg almost 8 years ago

  • Status changed from Open to Closed

Good idea Matthias, this is much more elegant.
I open a dedicated feature request.

#4 Updated by Regis Haubourg over 7 years ago

  • Status changed from Closed to Open
  • Description updated (diff)

I reopen that feature request, because the alternate proposal - adding another button - does not seem so nice to me, it's a lot of new clicks. A dedicated search dialog could be interesting too by adding richer search possibilities (like the select by Value dialog for instance), but I would say it's the advanced use case.
My need for classical apps would only be to filter the dropdown list using expressions, and nearest neighbor / distance computation + a rubberband on hover synced between the combobox and the map canvas.

Also available in: Atom PDF