Hi Yves,

I have only experience with PostgreSQL but I assume that sqlite behaves similar. If you edit a feature in QGIS your layer is in edit mode (allowing for undo/redo). Changes are committed only when you click on the respective button. This results in an update statement sent to your db which then calls your trigger. Thus field#2 is not changed when you change #1 _in QGIS_. In order to have such behaviour AFAIK you would have to do it in Python (which would be totally independent from the db trigger then).

Apart from that if
field#2 = field#1 + x
then field#2 is totally redundant. You could either create a view containing this field or create a virtual field in QGIS.

Bernhard


Am 09.09.2015 um 13:41 schrieb Yves Jacolin:
Hello,

I have a small project with a sqlite db. There is a layer with a trigger on a
field #1 to calculate an addition and put the result in another field (#2).

When I edit the initial field #1, the second field #2 is not updated in the
form. I need to close the form and open it again to see the result.

Do you think this is a known limitation or a bug?

My point of view is that it is a limitation, as QGIS don't know that a trigger
can change a value in the same feature server side.

I don't know if QGIS should or could get an update of the data server side
before display the form content.

In case there is no such plan, do you think we can add some logic in a python
script to force the form update (I can ask to Arnaud next week on this topic).

Thanks,

Y.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer




__________ Information from ESET Mail Security, version of virus signature 
database 12230 (20150910) __________

The message was checked by ESET Mail Security.
http://www.eset.com


_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to