3

Even though I found similar questions, I couldn't find a suitable answer for the problem I have.

I want to create a model that calculates the difference between two fields ("NUMPOINTS") from different vector files and populate a new field with the result in a new vector file.

My input are 2 vector layers: 'Events A' and 'Events B'. These tables have the same fields, including a common "id" field.

I need to create a 'Table C' where "DIFFERENCE" field is calculated as follow: "NUMPOINTS" ('Table B') - "NUMPOINTS" ('Table A')

So far, I managed to create a Join, but I don't know how to create a new field with input from the two input files.

enter image description here

1 Answer 1

5

you can use the fieldcalculator in your model to do the calculation:

enter image description here

since your fields have the same name "NUMPOINTS" you can use a prefix for the joind NUMPOINTS field in the JOIN operation:

enter image description here

the formula in the fieldcalculator would be:

enter image description here

2
  • It worked, thanks a lot! Aug 26, 2023 at 13:26
  • if this answer is a solution to your question you can mark the answer as accepted...
    – eurojam
    Aug 27, 2023 at 9:08

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.