[Qgis-user] Fill-down with QGIS expressions
Andrea Giudiceandrea
andreaerdna at libero.it
Mon Mar 29 05:40:53 PDT 2021
Totò wrote
> So the mistake I was making is using a virtual field (maybe it's a bug?)
Hi Salvatore,
you are right: it seem the expression is not correctly evaluated in a
virtual field (using the Field Calculator with the "Create a new field" and
"Create virtual field" options both checked).
Instead it is evaluated correctly with a non virtual field by either using
directly the Field Calculator with only the "Create a new field" option
checked or first creating a new empty field and then using the Field
Calculator with the "Update existing field" option checked.
Anyway I wrote a typo in the expression (but it is irrelevant in this case):
if( "zona" is Null, attribute( get_feature_by_id( @layer, $id-1 ),
'zona_fill2' ), "zona" )
[note << "zona" is Null >> instead of << "zona" is empty >>]
For a more general case, if fields values could be Null or '' then <<
nullif("zona", '') is Null >> should be used to catch both cases.
It may be worth investigating why the expression is not working in a virtual
field.
Best regards.
Andrea
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
More information about the Qgis-user
mailing list