3

I am trying to develop an expression whereby one layer can add data from 2 other layers and then rank them, is this possible? I have also tried the problem with using just 1 layer but I cannot work out an expression.

Example: I have 3 layers called "Tech", "Pol" and "Rank". All 3 layers contain a column 'Area' which has fields listing areas of a country. "Tech" and "Pol" both contain an integer column called 'T_col' and 'P_col' respectively and have fields containing data.

Problem: I would like the "Rank" column to add the fields in 'T_col' and 'P_col' and then sorting the order from least to most.

It's coming up with an expression that's confusing me, I don't know if it's possible to calculate data from other layers, hence why I don't mind using just the one.

I have created one layer with this columns and used the Expression String Builder to add up the 2 columns from "Tech" and "Pol". However, I am unsure as to how to include the result into the "rank" column. I tried using a simple code which is not recognised:

"rank" = "T_col" + "P_col" 
2
  • Do you have any common layer with unique values in both layers? For example an zone name? Jan 15, 2014 at 14:27
  • @AlexandreNeto. Yes I have a common zone name which was 'Area' but the problem has been resolved, thank you.
    – Joseph
    Jan 20, 2014 at 10:05

2 Answers 2

2

Your field calculator dialog should look something like this:

enter image description here

Make sure your fields are type numeric (whole number or decimal) and not text (string).

1
  • apologies for the late reply. This really helped me, thank you very much.
    – Joseph
    Jan 20, 2014 at 10:02
2

Depending on your exact case i see two options:

1) Join "Tech" and "Pol" onto the "Rank" table, using "Area" as the common column. Then the expression calculator can be used to fill the "rank" column on the "Rank" table.

2) Use the python console to calculate the values and modifies the "Rank" table based on it.

If you clarify your answer, or need more information leave a comment and i will update my answer.

1
  • apologies for the late reply. Your first option helped, thank you very much.
    – Joseph
    Jan 20, 2014 at 10:01

Your Answer

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

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