[Qgis-user] Filter in field group sections of report

Charles Dixon-Paver charles at kartoza.com
Mon Oct 11 10:51:17 PDT 2021


If you can define the filter expression and just have users change it,
there is also the option of using custom project, layout, or report
variables which the user can simply edit or update.

On Mon, 11 Oct 2021, 19:33 Jésahel Benoist, <djes1975 at gmail.com> wrote:

> Hello Yann,
>
> You can do it programmatically with python and a custom toolbar.
>
> But, I had a similar problem and happily, qgis as a multipurpose tool is
> widely accepted by average users and filtering can be easily explained.
>
> In fact my problem was worst, I have tens of layers. I created two layers,
> one with geometric feature, one linked to the previous with (let say)
> temporal features, and finally a virtual one linking the two previous for
> special purposes. All others layers are linked to the temporal one. I
> created and shared the multiple layers tools toolbar that permits to filter
> a set of layers based on the first in the list (which is the temporal). So
> when I click on the multiple filter button, all layers are filtered, and
> only the specific needed items are drawn and used for printing.
>
> Explaining the filter button tooks me 5 minutes, really, even to the most
> allergic to computers person I know. Of course readable fields names and
> readable values helps a lot !
>
> I can give you some later code for a custom toolbar with automatic
> filtering that I created to speed things.
>
> Regards
>
> Jésahel
>
> Le lun. 11 oct. 2021 à 14:33, Yann Voté <ygversil at lilo.org> a écrit :
>
>> Hi Jésahel,
>>
>> Thanks for your reply. Your proposed solution would be fine if it was
>> just me. What I forgot to say is the purpose: I want to share the QGIS
>> project with other users who have limited QGIS skills.
>>
>> A user story would be: the user opens the QGIS project, selects the
>> polygon layer A, selects the Generate Report action from the action
>> menu, clicks on the desired polygon, and the PDF report for the clicked
>> polygon gets generated.
>>
>> Or something similar with a processing algorithm.
>>
>> I think I found a workaround by using an atlas instead of a report. An
>> atlas is OK for this particular case: main polygon layer A related with
>> a non-geometric layer B whose data can be displayed within an Attribute
>> Table item. Contrary to a report, an atlas output can be filtered with
>> the `is_selected()` expression.
>>
>> I will continue to explore this path and let everyone know the found
>> solution in the forum thread when I'm done.
>>
>> But I still believe that, for more complex use cases, namely maps in
>> sections and related maps in subsections, which require a report, a
>> filter option would be extremely useful.
>>
>> Regards.
>>
>> Yann
>>
>>
>> Le 10/10/2021 à 23:20, Jésahel Benoist a écrit :
>> > Hi Yann,
>> >
>> > As I'm often using reports based on filtered datas, and as I see that
>> > you know how to filter, I don't really understand what is the problem.
>> > You can just apply a filter in the main ui on the a or b layer, or make
>> > virtual layers with only the needed datas. Then use the report (close
>> > when a change is made in the main ui).
>> >
>> > Regards,
>> >
>> > Jésahel
>> >
>> > Le dim. 10 oct. 2021 à 18:53, Yann Voté <ygversil at lilo.org
>> > <mailto:ygversil at lilo.org>> a écrit :
>> >
>> >     Hi everyone,
>> >
>> >     Let's imagine we have a polygon layer named Layer A with tons of
>> >     features (tens of thousands), and an attribute layer named Layer B
>> with
>> >     even more features. Each polygon in Layer A is associated with one
>> or
>> >     more rows in Layer B.
>> >
>> >     Now suppose we have created a report with a top section for Layer A
>> >     containing a map centered at each polygon, and a subsection for
>> Layer B
>> >     showing attributes for each related B row.
>> >
>> >     Is there a way to output the report for exactly one polygon in
>> layer A,
>> >     or for only some polygons (for example selected polygons) ?
>> >
>> >     And is there a way in the subsection to output only some of the
>> related
>> >     rows based on some filter expression ?
>> >
>> >     I am aware of this feature request
>> >
>> >     https://github.com/qgis/QGIS/issues/44821
>> >     <https://github.com/qgis/QGIS/issues/44821>
>> >
>> >     but is there a way to achieve this with more steps in the UI or with
>> >     pyQGIS ?
>> >
>> >     Thanks a lot !
>> >
>> >     Regards.
>> >
>> >     --
>> >     Yann Voté - ygversil at lilo.org <mailto:ygversil at lilo.org>
>> >     _______________________________________________
>> >     Qgis-user mailing list
>> >     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>> >     List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> >     <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>> >     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> >     <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>> >
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211011/a776d9a9/attachment.html>


More information about the Qgis-user mailing list