I use QGIS 3.10 with the graphical modeler and I'm facing an issue while creating new field in field calculator: it seems to be case insensitive thus it does not create the field I want.

Problem description follows:

  1. Using Distance matrix algorithm, a layer is created with a field named Distance (and the name of the field can't be chosen)
  2. I want to rename this field to distance to be compliant with further processing tools (REST API expecting a distance attribute)
  3. I tried using Field Calculator to create a new field distance based on the value from the Distance field
  4. When I run the model, the new field isn't created

If I choose a different name for the new field (like foo) everything runs fine. But how can I create 2 different fields with only case difference (then remove one of them).

I tried using Refactor fields as an alternative, but if I don't know the list of attributes in input layer, I can't properly use it. Am I missing something in the configuration or is it an issue I should report on qgis github ?

  • 3
    Could you do it as a multi-step process? First use field calculator to transfer values to a 'Temp' field. Then delete the original 'Distance' field. Use field calculator again to new 'distance' field. Finally delete 'Temp' field.
    – JClarkson
    Commented Dec 17, 2020 at 11:18
  • Yes, that's the trick I am using atm, but it adds 3 more steps for a relative quite simple operation, so I was wondering if I could do it in a more simple way.
    – Beinje
    Commented Dec 17, 2020 at 11:32
  • 1
    If fieldcalculator doesnt work and refactor is not an option, i would try the latest qgis version and then make a request on qgis github site. So far the workaround by jclarkson seems to be the only option then.
    – MrXsquared
    Commented Dec 17, 2020 at 15:22

1 Answer 1


You can look at/load the attribute tables of currently existing layers in your project from the refactor fields dialogue in the modeller.

So, you create your model up to the point where you need to use refactor fields and run it once. Then you return to the modeller and add the table of the newly created layer to your model.

Or, as JClarkson pointed out in the comments, you could hand your Distance values to a dummy field, delete Distance, then create distance based on the dummy field and finally delete the dummy field.

  • In fact, I'm creating the model to simplify the process for users and give them the ability to process their data before sending it to the API. So I can't ask them doing that much manipulations.
    – Beinje
    Commented Dec 17, 2020 at 11:44
  • @Beinje sorry, maybe I didn't express myself clearly: YOU as the creator of the model do this one single time. Then, later, everyone else who runs the model doesn't have to, since the model knows, how the attribute table created by your first tool will look like.
    – Erik
    Commented Dec 17, 2020 at 11:50
  • 1
    oh OK I didn't get your point. Yet, some users may have useful additional fields in their input data that I don't know of. So these fields would not appear in their final output...
    – Beinje
    Commented Dec 17, 2020 at 11:52
  • 1
    Then you'll have to roll with the second approach.
    – Erik
    Commented Dec 17, 2020 at 12:06

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.