I have a survey form and some features (trees) will be grouped using the same "TreeNumber"
.
Hopefully, I can write an expression that means users only have to fill in most of the data for one feature, and the expression with fill in the gaps in another set of virtual fields for the other features.
So far I have tried the expression below which I hoped would return the maximum value from all the features filtered to match the current feature "TreeNumber"
but it just crashes QGIS.
maximum("Species", "TreeNumber" = attribute($currentfeature, "TreeNumber"))
1 Answer 1
Try this expression:
with_variable(
name:='currentTreeNumber',
value:="TreeNumber",
expression:=maximum(
expression:="Species",
filter:="TreeNumber"=@currentTreeNumber
)
)
$currentfeature
inside an aggregate returns features of the aggregation, you can store the value of the field of interest of the current feature in a variable with the with_variable()
function and then compare it with the value inside the aggregate.
-
Many thanks! I have to look at the help file for with_variableSethinacan– Sethinacan2022年11月02日 20:27:33 +00:00Commented Nov 2, 2022 at 20:27
Explore related questions
See similar questions with these tags.