You could try a "CASE" expression:
expression CASE
CASEWHEN conditionTHEN result[ …n ][ ELSE result]END
[ ] marks optional components
Arguments
WHEN condition- The condition expression to evaluate.
THEN result- If conditionevaluates to True then resultis evaluated and
returned.
ELSE result- If none of the above conditions evaluated to True then
resultis evaluated and returned.
Example
CASEWHEN "ID" = 1 THEN 'Yellow'
WHEN "ID" = 2 THEN 'Green'END
Hope this helps,
David
On 8/17/2020 7:20 PM, krishna Ayyala wrote:
I have the following attribute table with two fields ID and ID2
image.png
What expression can I use within the field calculator so that, I can
fill the values for ID2 as below?
ID ID2
1 Yellow
2 Green
3 White
4 Blue
5 Orange
6 Brown
7 Light Blue
8 Light Yellow
9 Light Green
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user