The problem:

I have a model with several input parameters (e.g. input_holesize, input_threshold etc.). The model creates a polygon layer as its final output. I would like to save the parameters into the attribute table for each feature in order to make the results more transparent. I use QGIS 3.16.7 on a Windows 10 system.

Attempts of solution:

I added another field calculator operation as another algorithm to my model. I wanted to use the function parameter, which seems quite straightforward (function example given in the field calculator: parameter('BUFFER_SIZE') → 5.6). I tried various variants (e.g. parameter('input_threshold') as well as parameter(input_threshold) and parameter("input_threshold") and to_string(parameter('input_threshold'))). For none of these functions the field calculator returns an error message, however, the output is allways an empty field.

Aparently I am using the wrong syntax, or the function is actually not what I need.

My question:

Does anyone know, how to write the input parameters of a model into the attribute table of the output layer?

1 Answer 1


The parameter function is used to get input parameters of the current tool. So create an input in the model designer and then you can call it by @Description, Description being the name of the input.

  1. Open the Model Designer and select a number input (I will call it Input Integer). Inputs enter image description here
  2. Set the input that you defined befor as the input of the tool you want to run (lets say a buffer and the input integer will be the distance). enter image description here
  3. Now we add the field calculator and calculate a new field with @inputinteger expression. enter image description here
  • Thanks for the answer. Could you elaborate some more? I tried to call e.g. @input_threshold in the field calculator but still get an empty output. Jun 13 at 5:10
  • Ok, I update the answer.
    – Mayo
    Jun 13 at 22:40
  • Thanks for the clarification. I do not have this parameter in my field calculator. Which version of QGIS do you use? I updated my question with my current version. Jun 16 at 5:16
  • 3.24.3-Tisler in Ubuntu 22.04
    – Mayo
    Jun 16 at 13:33
  • According to the changelog this is a new feature in Version 3.24 and not available so far in the LTR-Version 3.22. Jun 26 at 5:03

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.