[Qgis-user] Use form with checkboxes to alter a query?

Jorge Gustavo Rocha jgr at geomaster.pt
Sun Dec 15 03:20:08 PST 2019


Hi Bernd,

May I suggest two tables?

You can create another table *control*, with just two columns: name and
active.

This could be filled with:

select distinct name, true from areas;

Your query would be like:

SELECT *
FROM areas
WHERE name IN (select name from control where active)

To change the virtual layer, you just need to open the *control* table
and click on the active column to set/unset as active. (You may have to
change the active column's edit widget to make it a checkbox).

I didn't test it.

Regards,

Jorge

On 12/12/19 17:12, Bernd Vogelgesang wrote:
> Hi,
>
> I have a layer with over 150 polygons, where 20 to 30 of them change
> their access status on a daily base. The information about the status
> comes in a quiet unstructured pdf, so there is no way to automatically
> read that in.
>
> At the moment, I query the layer through a virtual layer like this to
> show the subset of restricted areas:
>
> SELECT *
> FROM areas
> WHERE name IN ('a','b','c','l','p', 'x','y','z')
>
> It is quite a tedious job to fiddle in the names into the query string
> every time, so I wonder if anyone knows a way, how to connect a form
> with check boxes of those area names, so when I submit it,
> only the checked names will be inserted in that query.
>
> I'm quite sure that this should be possible somehow, but I lack of any
> idea where to start. Or maybe solve this on a complete different way?
>
> Cheers,
> Bernd
>
>
> -- 
> Dipl.-Geogr.
> Bernd Vogelgesang
> Siedlerstraße 2
> 91083 Baiersdorf/Igelsdorf
> Tel: 09133-825374
> _______________________________________________
> 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
-- 
Email Signature
Logo <https://www.geomaster.pt> 	
*Geomaster*
*Jorge Gustavo Rocha* | Software Engineer
*e:*jgr at geomaster.pt | *m:*+351 910 333 888
*g:*41.54094,-8.40490 | *v: *510 906 109
*a: * Rua António Cândido Pinto, 67, 4715-400 Braga

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20191215/be6e8311/attachment.html>


More information about the Qgis-user mailing list