Field expression bug #3019
Replies: 2 comments 2 replies
-
Hi @olegzhelezn, We are going to have a look on this issue, but we do not know exactly when. Best regards |
Beta Was this translation helpful? Give feedback.
-
Hello @olegzhelezn, one possible solution would be creating an SQL Trigger on your layer for that, which populates your ch_dates history field with the date versions. It's a standard known by several database systems like Sqlite/GeoPackage and PostgreSQL. It could be like this (Sqlite flavor): drop trigger if exists set_ch_date_history;
create trigger if not exists set_ch_date_history after update of ch_date, ch_dates on mylayer
when new.ch_date is not null and (new.ch_dates is null or old.ch_dates not like '%;' || new.ch_date || ';%')
begin
update mylayer
set ch_dates = coalesce(t.ch_dates,'') || new.ch_date || ';'
from (select * from mylayer where fid=old.fid) as t
where mylayer.fid=old.fid;
end your mylayer would look like this: |
Beta Was this translation helpful? Give feedback.
-
Greetings to the QField community!
Writing here to report a potential bug and ask for advice.
I have a vector layer with some of the fields regulated by default expressions. Specifically, there is a set of points which need to be regularly updated, and i am trying to do it in such a way that the original point preserves the information about all updates.
For this, I have created two types of fields (=> columns in the attribute table):
For example:
I have a field called ch_date (checkup date), which is being transformed into a string and summarised in the ch_dates field, which has a default value of:
"ch_dates" +';' + to_string( "ch_date")
This works perfectly in QGIS, with ch_dates containing all checkup dates in the form of delimited string.
However, in QField the cumulative data field gets updated twice, once when writing the attribute, and then second time when saving the updated feature. If the attribute is rewritten (edited) before saving the feature, than the date is added again, and again, and again...
This is not very comfy, but it works in some way, though.
But when it comes to the same expression with string data, e.g.:
"ch_values" +';' + "ch_value"
-- then it does not work in QField whatsoever...
Could this be addressed in the future releases?
Or maybe, someone might recommend a way to solve this in an alternative way? E.g. creating nested tables somehow?...
Beta Was this translation helpful? Give feedback.
All reactions