[Qgis-user] Updating multiple parent/child records simultaneously

McDonaldR McDonaldR at angus.gov.uk
Wed Oct 2 03:35:25 PDT 2019


Hi list,

I've got a project set up in QGIS 3.4.x with a parent polygon layer and a child attribute layer.  Each site polygon represents a piece of land and can have multiple tasks associated with it (grass cutting, weeding, pruning, etc.).  Sites can be made up of multiple polygons.

With relations set up in the project it is easy to select a polygon feature and update attributes.  It is easy to add or edit associated tasks.  See screenshots below.  With multiple site polygons selected I can use the "modify selected attributes simultaneously" to update information.

I need to find a way to be able to select site polygons and add the same associated task to each one.  For example, select all site polygons that need grass cutting task associated with them, assign the task and maintain the parent child relationship.  It would be great if there was a way to do this through the form.

One solution I have been toying with is using a SQL query to select the site polygons and insert into the associated tasks table a new record associated with each polygon.  The query works but I need a way to tie it into the form.  Anyone got any pointers?  Some python to call the SQL and get the selected feature IDs from QGIS?

Thanks

Ross

Screenshot 1: https://nextcloud.mixedbredie.net/s/D7DFjs2PrcnEf7t

Screenshot 2: https://nextcloud.mixedbredie.net/s/EBzeTopsBcZBSJc





Ross McDonald | Geo-evangelist | Angus Council, Digital Enablement and IT | Angus House, Orchardbank Business Park, Sylvie Way, Forfar DD8 1AT | t: 01307 49 22 39


This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20191002/7134ed1c/attachment.html>


More information about the Qgis-user mailing list