I want to link 2 number values (RMSE & dosemax) in a field calculator formula. When I run the modeler, I add these values but it doesn't recognize them. I dont want to create a new table. Just use these number in the formula.

enter image description here

enter image description here

  • You can't do this directly using the number parameters. You will need to create a custom script which reads those number values, inserts them into a string expression, and finally outputs the expression as a string parameter which can then be fed into the Field Calculator tool.
    – Joseph
    Commented May 25, 2018 at 12:42
  • I starts to be hard for me to follow. Do you have a picture of where i can do this script ?
    – Marc Robin
    Commented May 25, 2018 at 12:44

1 Answer 1


To create a custom script, you can go to the Processing Toolbox > Scripts > Tools > Create new script and use something like the following (change the expression accordingly, you do not need to add quotes around the number parameters):

##expression=output string

dose = str(dosemax)
rmse = str(RMSE)
expression = 'if("moyennemea" < minumum("moyennemea")+3*rmse, 0.75*dose, dose)'

Save the script into your /.qgis2/processing/scripts directory. Then add the script to your model selecting the input number parameters for the script:

Script parameters

Then in the Field Calculator tool, select the script for the expression:

Field calculator

The expression should now use the number values from the parameters.

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.