I have a layer with around 1000 lines. Some Name are repeated several times and I wish to have every name unique. Thus I try in the field calculator to add an integer at the end of the name only when it is a duplicate, and of course I want to increment the integer value each time it is used. As an example, in my layer I have in the Column 'Name':
Name_One Name_One Name_Two Name_Two Name_One
And I would like it to become
Name_One1 Name_One2 Name_Two1 Name_Two2 Name_One3
I tried first to identify the duplicate with the function
if(count("Name", "Name") = 1, 1, 0)
Then with the new column "uniqueness" that hold the value of the previous command I try
CASE WHEN 'uniqueness' = 0 THEN @a WHEN 'uniqueness' = 0 THEN @a = @a+1 ELSE @a = 1 END
(@a is a project variable equal to 1)
But it doesn't work.
How can I do that?