{"action":"created","issue":{"url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/116","repository_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals","labels_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/116/comments","events_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/116/events","html_url":"https://github.com/qgis/QGIS-Enhancement-Proposals/issues/116","id":305248756,"number":116,"title":"Allow Drill-down (cascade) search in Value Relation Widgets","user":{"login":"elpaso","id":142164,"avatar_url":"https://avatars1.githubusercontent.com/u/142164?v=4","gravatar_id":"","url":"https://api.github.com/users/elpaso","html_url":"https://github.com/elpaso","followers_url":"https://api.github.com/users/elpaso/followers","following_url":"https://api.github.com/users/elpaso/following{/other_user}","gists_url":"https://api.github.com/users/elpaso/gists{/gist_id}","starred_url":"https://api.github.com/users/elpaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elpaso/subscriptions","organizations_url":"https://api.github.com/users/elpaso/orgs","repos_url":"https://api.github.com/users/elpaso/repos","events_url":"https://api.github.com/users/elpaso/events{/privacy}","received_events_url":"https://api.github.com/users/elpaso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2018-03-14T17:06:09Z","updated_at":"2018-03-28T08:10:18Z","closed_at":null,"author_association":"NONE","body":"# QGIS Enhancement: Allow Drill-down (cascade) search in Value Relation Widgets\r\n\r\n**Date** 2018/03/18\r\n\r\n**Author** Alessandro Pasotti (@elpaso)\r\n\r\n**Contact** elpaso at itopen dot it\r\n\r\n**maintainer** @elpaso\r\n\r\n**Version** QGIS 3.2\r\n\r\n# Summary\r\n\r\nThis is basically a port of the 2.x Form Aware Value Relation Widget plugin https://github.com/elpaso/qgis-formawarevaluerelationwidget/\r\n\r\nThe plugin for 2.x allowed to create value relation expressions based on the current value of another field in the same form.\r\n\r\nWhen the value changes in the current field, the values available in the related fields are filtered again allowing to use a hierarchical filtering strategy (drill-down, or cascading) inside a form.\r\n\r\nPlease see the readme in https://github.com/elpaso/qgis-formawarevaluerelationwidget/ for a visual explanation or see the video at https://www.youtube.com/watch?v=ipezh4KXrgo\r\n\r\n\r\n## Proposed Solution\r\n\r\nThe proposed implementation is an enhancement of the current classes `QgsValueRelationSearchWidgetWrapper` and `QgsValueRelationFieldFormatter`, by adding a \r\n `QgsExpressionContextUtils::formScope` that holds current form values, passed by the form widget or the `QgsAttributeEditorContext`.\r\n\r\nA new function `get_current_form_value` will be added to the layer's form widget expression editor, the function will retrieve the current value of another form field in the form or table row that is currently being edited.\r\n\r\nIn case the form scope is not required the internal workflow of the existing classes is not altered in any way and it is supposed to maintain the current behavior and performances.\r\n\r\nThe 2.x original plugin did not work at all in the attribute table row contex: this limitation will be removed by the proposed implementation.\r\n\r\n### Affected Files\r\n\r\nAbove mentioned classes plus `qgsexpressioncontext.h`  and other expression files for the new expression function `GetCurrentFormFieldValue`.\r\n\r\n## Performance Implications\r\n\r\nNone affecting existing workflows.\r\n\r\n## Further Considerations/Improvements\r\nThere are indeed some considerations about caching when a form context is required: for this kind of dynamic relations the usual caching of kvp for the widgets is bypassed and the features are re-filtered any time the value used in the expression changes.\r\n\r\nThis might not scale well on some scenarios and a smarter caching approach might be required as further enhancement.\r\n\r\n## Backwards Compatibility\r\n\r\nNo issues.\r\n\r\n## Issue Tracking ID(s)\r\n\r\nThere should be something buried in the issues tracker but I couldn't find it now, please let me know if you find it.\r\n\r\n## Votes\r\n\r\n(required)\r\n"},"comment":{"url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/comments/376799653","html_url":"https://github.com/qgis/QGIS-Enhancement-Proposals/issues/116#issuecomment-376799653","issue_url":"https://api.github.com/repos/qgis/QGIS-Enhancement-Proposals/issues/116","id":376799653,"user":{"login":"m-kuhn","id":588407,"avatar_url":"https://avatars1.githubusercontent.com/u/588407?v=4","gravatar_id":"","url":"https://api.github.com/users/m-kuhn","html_url":"https://github.com/m-kuhn","followers_url":"https://api.github.com/users/m-kuhn/followers","following_url":"https://api.github.com/users/m-kuhn/following{/other_user}","gists_url":"https://api.github.com/users/m-kuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kuhn/subscriptions","organizations_url":"https://api.github.com/users/m-kuhn/orgs","repos_url":"https://api.github.com/users/m-kuhn/repos","events_url":"https://api.github.com/users/m-kuhn/events{/privacy}","received_events_url":"https://api.github.com/users/m-kuhn/received_events","type":"User","site_admin":false},"created_at":"2018-03-28T08:10:18Z","updated_at":"2018-03-28T08:10:18Z","author_association":"MEMBER","body":"I see, so the feature gets set from the related layer (and not from the current layer). That definitely makes sense!"}}
{"actor":{"display_login":"m-kuhn"}}