[Qgis-user] CASE WHEN .... Field Calculator.

Håvard Tveite havard.tveite at nmbu.no
Tue Nov 4 11:53:53 PST 2014


Both

CASE WHEN "A" like '30STH400500' THEN (30 + 20 + 10) ELSE 0 END

and

CASE WHEN "A" = '30STH400500' THEN (30 + 20 + 10) ELSE 0 END

should work.

If you want to assign this to D, you must specify D in
"Output field name".

Håvard

On 04. nov. 2014 20:29, Matías Taborda Barroso wrote:
> Hi.
>
> I'm spanish user, sorry for my English. I'm using Google translator.
>
> I have a .shp points file with attribute table. Like this...
>
> |-- A --     -- B --      -- C --
>    QString     Double        Double        Data type
> 30STH400500     1            30
> 30STH400500     1            30
> 30STH400500     1            30
> 30STH400500     1            30
> ...........    ...          ...
> ...........    ...          ...
>
> 30STH400500     2            10
> 30STH400500     2            10
> 30STH400500     2            10
> 30STH400500     2            10
> ...........    ...          ....
> ...........    ...          ....
>
> 30STH400500     3            20
> 30STH400500     3            20
> 30STH400500     3            20
> 30STH400500     3            20
> ...........    ...          ....
> ...........    ...          ....
>
> 30STH450450     1            10
>
> ...............................
> ...............................||
> |
>
> I have 50 different valuesv of A field.
>
> And now, I want a new field, "D" (Data type, double) like this in field
> calculator:
>
> |WHEN "A"='30STH400500' THEN/*D = 30 + 20 + 10 = 50*/|
>
> I don't know if I have explained it.
>
> I've tried using CASE WHEN A..... THEN .... ELSE but I don't get it.
>
> I think that with plugin Fieldpyculator, but I don't know python
>
> Please, help me.
>
> Thanks.
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>



More information about the Qgis-user mailing list