4

I'm creating a model in Modeler in QGIS3.4. I want to use a "Add autoincremental field" tool. I want to group my field by two other fields (it works when I set it "normally", not in Modeler). I think I have an error in syntax. I work in a polish version, so it is a window of "Add autoincremental field" opened through Modeler.

Now we're interested in a "Grupuj wartości według" -> it's "Group values by". I want to group by 2 fields: "sekcja" (it's integer filed) and "numer_inwe" (it's string field, but filled with numbers, so we can switch it to integer as well). When I do it separatly it works, but the problem appears when I want to use both fields to group my table.

What syntax should I use if i want to group my table by 2 fields?

Window of Add autoincremental field

1 Answer 1

3

It requires a string list as input:

['sekcja', 'numer_inwe']

But if you're going to use it through the modeler, might I suggest using the Vector field input parameter which can be set to accept multiple fields. You can connect this parameter to the "Add autoincremental field" tool. Then when you run the model, you can simply choose the fields you want grouped from a checkbox list instead of having to manually type the field names in.

4
  • 1
    I also tried that type of string list, but it didn't work. However! Second option with "Vector field" worked exactly how I wanted! Thanks a lot!
    – ann
    Commented Jan 8, 2020 at 10:51
  • @ann - The first method should have worked, perhaps a version issue as I am using QGIS 3.10. But most welcome, glad you got it working with the second method :)
    – Joseph
    Commented Jan 8, 2020 at 10:55
  • Now I find out how should I do it without "Vector field". Instead of ['sekcja', 'numer_inwe'] I should write sekcja;numer_inwe So, semicolon was the answer :)
    – ann
    Commented Jan 8, 2020 at 12:09
  • @ann - Interesting, nice one for finding out the solution to your original problem which I would suggest you post it as an answer :)
    – Joseph
    Commented Jan 8, 2020 at 12:15

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.