I create new field based on other fields. For example; if "Field_A" is smaller than "Field_B", value of new field is 'A', otherwise it is 'B'. So I want to create new variable for this case within Expression area.
It's possible in QGIS 3 by means of
with_variable function. But QGIS 2 don't have that function.
In QGIS 3:
# mn -> new variable with_variable( 'mn', min( "Field_A", "Field_B" ), if( @mn = "Field_A", 'A', 'B' ) )
with_variable( 'mn', min( "Field_A", "Field_B" ), case when @mn = "Field_A" then 'A' else 'B' end )
In QGIS 2, I want to write something like that:
mn = min("Field_A", "Field_B") CASE WHEN mn = "Field_A" THEN 'A' WHEN mn = "Field_B" THEN 'B' END
I don't mean global or project variable, I'm asking to create a new variable to be used in Expression area scope.
How can I do that within Expression area in QGIS 2?