When trying to divide a vector field parameter with an output calculated during the model process I get a No root node, parsing failed! error at the point in which the field calculator in the model tries to run.

My aim is for the vector field parameter @testfield to be divided by another field created in a step previous @Join_attributes_by_location__test2__OUTPUT which itself is based of another vector field parameter.

The expression I have tried is @testfield / @Join_attributes_by_location__test2__OUTPUT

enter image description here


The variable '@testfield' is just a constant string value containing the name of the selected field. Placing it in an expression doesn't give you the field value, just the name of the field.

You need to use the "attribute" function to do what you're after:

attribute($currentfeature, @testfield)

Additionally, @Join_attributes_by_location__test2__OUTPUT will contain the name of the output layer from that algorithm, not a field name. You'll need to use another approach to get that generated field name, and also use the attribute function to resolve it's value.

  • Thanks I didn't know about the attribute function. – AWGIS Mar 4 at 16:44
  • I cannot figure out another approach to include the Join_attributes_by_location__test2__OUTPUT - should I ask another question or can this be answered here? – AWGIS Mar 5 at 14:19

Use feature called parent algorithm. You can find it at the bottom of every script. Just link the script in sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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