Skip to main content

Hi,

can someone help me with the Python expression, please...

I need to get a summary of "sum A" and "Sum B"

wenn I write: "sum A"+"sum B" I get an result: "sum Asum B"

theese "sum A" and "sum B" must be written as a string, because I get this sum from calculating a few fields.

 

 

If you have two attributes entering a PythonCaller named "sum A" and "sum B" containing numbers, you can do

sum_a = float(feature.getAttribute('sum A') or 0)
sum_b = float(feature.getAttribute('sum B') or 0)
feature.setAttribute('total', sum_a + sum_b)

This will output a new attribute 'total' that contains the sum of these two numbers.

If this is not what you mean, we need a bit more context.


Reply