Re: [Qgis-user] Forms, realtions and foreign keys

2019-06-04 Thread Karl Magnus Jönsson
Thanks. Works perfect. I  missed the "initially deferred" in the FK.

Karl-Magnus

Från: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] För Matthias Kuhn
Skickat: den 4 juni 2019 11:27
Till: qgis-user@lists.osgeo.org
Ämne: Re: [Qgis-user] Forms, realtions and foreign keys


Hello,

If you enable "evaluate default values server side" and "automatic transaction 
groups" and set the foreign key check in the database to initially deferred 
you'll get pretty much what you want :)

Hope that helps

Matthias
On 6/4/19 11:14 AM, Karl Magnus Jönsson wrote:
Hi list!
I have a project with tree tabels stored in PostGIS. One is holding the 
geometry the other two is holding data related to the first table as child and 
grandchild. I have set up foreign keys between the tables in the database to be 
sure that there will be no orphan records. In QGIS there are relations and 
(sub)forms. When I digitize a new geometry I get the new id from the database 
(before it's saved, OK) in the form but I can't add any children. I get a 
database error that says that there are no parent with that ID (and that's 
true). I have to  press OK to create the feature in QGIS, change tool to 
identify, find the feature and klick on it to open the form again. Then I can 
add children. But I haven't saved so there is still no parent. But it works 
then. It's the same with the grandchild table but then the grandparent form is 
still open so it's not such a big problem. Anyone got a better way to skip this 
closing and reopening of the form in the workflow?

Karl-Magnus Jönsson | Gis-Utvecklare
Geografisk information
Miljö- och samhällsbyggnadsförvaltningen
Kristianstads kommun
Besöksadress: Västra Storgatan 12
Postadress: 291 80 KRISTIANSTAD
Telefon: 044-135416 | Mobil: 0733-135416
E-post: 
karl-magnus.jons...@kristianstad.se<mailto:karl-magnus.jons...@kristianstad.se>
www.kristianstad.se<http://www.kristianstad.se/>

Läs mer om hur vi hanterar dina personuppgifter på 
www.kristianstad.se/personuppgifter<http://www.kristianstad.se/personuppgifter>




___

Qgis-user mailing list

Qgis-user@lists.osgeo.org<mailto:Qgis-user@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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Forms, realtions and foreign keys

2019-06-04 Thread Matthias Kuhn

Hello,

If you enable "evaluate default values server side" and "automatic 
transaction groups" and set the foreign key check in the database to 
initially deferred you'll get pretty much what you want :)


Hope that helps

Matthias

On 6/4/19 11:14 AM, Karl Magnus Jönsson wrote:


Hi list!

I have a project with tree tabels stored in PostGIS. One is holding 
the geometry the other two is holding data related to the first table 
as child and grandchild. I have set up foreign keys between the tables 
in the database to be sure that there will be no orphan records. In 
QGIS there are relations and (sub)forms. When I digitize a new 
geometry I get the new id from the database (before it’s saved, OK) in 
the form but I can’t add any children. I get a database error that 
says that there are no parent with that ID (and that’s true). I have 
to  press OK to create the feature in QGIS, change tool to identify, 
find the feature and klick on it to open the form again. Then I can 
add children. But I haven’t saved so there is still no parent. But it 
works then. It’s the same with the grandchild table but then the 
grandparent form is still open so it’s not such a big problem. Anyone 
got a better way to skip this closing and reopening of the form in the 
workflow?


*Karl-Magnus Jönsson*| Gis-Utvecklare
Geografisk information
Miljö- och samhällsbyggnadsförvaltningen
Kristianstads kommun
Besöksadress: Västra Storgatan 12
Postadress: 291 80 KRISTIANSTAD
Telefon: 044-135416 | Mobil: 0733-135416
E-post: karl-magnus.jons...@kristianstad.se 


www.kristianstad.se 

Läs mer om hur vi hanterar dina personuppgifter på 
www.kristianstad.se/personuppgifter 




___
Qgis-user mailing list
Qgis-user@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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user