I am trying to use the Sextante field calculator to calculate a field for a buffer radius using a categorical text field. The formula works fine when I run it using the standard QGIS field calculator via the attribute table:
When I use the same formula from the Sextante toolbox however (algorithms for vector layers), it produces only null values.
This is the formula I'm using:
case when "PointConfL" = '10-50 km' then 50000
when "PointConfL" = '5-10 km' then 10000
when "PointConfL" = '2-5 km' then 5000
when "PointConfL" = 'centroid of farm' then 10000
else 50000
end
It seems to not matter whether the new field exists before or not: if it doesn't exist, it is created, but in both cases, all values are NULL.
Am I using the 'algorithm' incorrectly, or is this perhaps a bug in the plugin?
EDIT: I found the error log in ~/sextante
, but it doesn't shed much light on the problem:
ALGORITHM|Wed Oct 24 2012 17:08:08|Sextante.runalg("sextante:fieldcalculator","/home/rudi/personal/GIS/projects/transform_count/364-236.shp","buffer_sextante","case when "PointConfL" = '10-50 km' then 50000 when "PointConfL" = '5-10 km' then 10000 when "PointConfL" = '2-5 km' then 5000 when "PointConfL" = 'centroid of farm' then 10000 else 50000 end")
ERROR|Wed Oct 24 2012 17:08:08|Problem evaluation formula: Wrong field values or formula
"
and'
), but I tried changing them all to'
and it still had the same resultbufQGIS * 2
), the field calculator works, but all apostrophes should be removed from field names. I have not managed to get even a simple case statement to work yet.