[Qgis-user] Field Calculator Expression
David Greenewalt
dlg at sover.net
Mon Aug 17 17:28:03 PDT 2020
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 at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200817/ac1ce6a4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27586 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200817/ac1ce6a4/attachment-0001.png>
More information about the Qgis-user
mailing list