3

I have an issue withe the field calculator. It is impossible for me to multiplicate 2 columns (area * KZ). The result is always "0". I used the formula area * KZ....is this the right formula? LINK to shape file Here the steps I did:

  1. Using the "advanced python field calculator" to replace the strings "A"into 1, "B" into 2, "C" into 3 and so on
  2. Using the field calculator (processing plugin) with the formula KZ * area without success

screenshot field calculator

10
  • 1
    There is no .dbf in your zipfile, so there is no attributes linked with your shapefile Feb 27, 2014 at 15:35
  • Try now again, please.
    – Pimpel
    Feb 27, 2014 at 15:43
  • The .prj file claims to be WGS84, but the extent is something in meters.
    – AndreJ
    Feb 27, 2014 at 15:49
  • Is this aproblem for the calculator?
    – Pimpel
    Feb 27, 2014 at 15:58
  • I tryed with the processor Field Calculator and it worked. 'area' * 'KZ' Feb 27, 2014 at 17:20

3 Answers 3

2

Quote your fields like this:

'area' * 'KZ'
0

Please check if your columns are of type integer or real.

In many cases they are of type string, which requires to change the format using toint() or toreal() functions in field calculator.

1
  • Sorry, I sent you an old file with a string type. I also tried it (processing - field calculator) with a real type...without success.
    – Pimpel
    Feb 27, 2014 at 15:57
0

I tryed to do what you want with your shapefile in QGIS

  1. I created a new real (float) field (length: 20 precision: 10)
  2. I used the Field Calculator with this command: "area" * "KZ"

Results:

enter image description here

2
  • I tried it withe the "processing" field calculator, because I want to use it later in a model. But it doesnt work.
    – Pimpel
    Feb 27, 2014 at 15:53
  • 1
    Please edit your question to enumerate all steps you are doing in details Feb 27, 2014 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.