0

I've got a Layer where old data versions are still in the layer. We've got the field "name" and the field "Version". The problem is that not every Name gets a new Version at the same Time. So some names are still version 1, others are version 5. Now I have to find the newest Version for every Name and put only them in the new Layer.

Right now it takes me two hours to do so manually (in Excel CSV)...

Each feature has one entry for "name" and "Version".

So names are repeating: several features have the same name, but different versions.

And now I want to compare all features with the same name to see which one has the newest version.

I am not deep into QGIS and using a German version but I'll try to explain: There is a Vector function which extracts by attribute; that is not working since it only asks for one attribute I thought about using the field calculator but I can't work out how to do such complex things like asking other IDs if they've got the same name. I have no other ideas yet.

3
  • Can you please show these records? What have you tried by so far/What are your ideas?
    – Taras
    May 26, 2021 at 6:54
  • Each feature has one entry for "name" and "Version", right? So names are repeating: several features have the same name, but different versions? And now you want to compare all features with the same name to see which one has the newest version? Sorry, as of now, your question can't be answered because it lacks basic information about your data structure and your goal.
    – Babel
    May 26, 2021 at 6:58
  • @Jonas Bon: you should edit your question and insert your clarifications there, than delete the comments.
    – Babel
    May 26, 2021 at 7:37

1 Answer 1

3

"version" = maximum("version","name") does what you're looking for. You need to enter it in the select by expression dialogue.

maximum searches for the highest value in the column version, which is in this case also grouped by the field name. Then you need to compare your result with the actual entry in the version-field. If the version is the highest within each "group", it will be selected.

3
  • ok thanks so far but where to enter that line ? what do you mean by "compare your results" ? like by hand ? I can create a new field VersionMax. which works; but how to go on from here; I would need a new layer with only the ones that have a max version Sorry if I am stupid now ...
    – Jonas Bon
    May 26, 2021 at 7:58
  • Sorry, I thought you mentioned something about select by expression. That's where this needs to go. The second paragraph is simply an explanation of what the expression does.
    – Erik
    May 26, 2021 at 8:16
  • Thank you very much that Worked :)
    – Jonas Bon
    May 26, 2021 at 8:27

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.