I have a Spatialite table (basicinf) with quite a few fields including Longitude, Latitude and Geometry fields. I managed to write a trigger to update the Geometry field when my Lat/Long change, but not the other way round. My trigger code is:
CREATE TRIGGER basicinf_after_update_geom
AFTER UPDATE ON basicinf
FOR EACH ROW
WHEN NEW.GEOMETRY != OLD.GEOMETRY
BEGIN
UPDATE basicinf
SET LATITUDE = Y( NEW.GEOMETRY ),
LONGITUDE = X( NEW.GEOMETRY ),
NGDB_FLAG = 9
WHERE SITE_ID_NR = OLD.SITE_ID_NR;
END;
Now when I move my point in QGIS the trigger is not fired. Why not? I use the NGDB_FLAG to see if it has fired and also use it in my app to do other things.
Any help would be appreciated.