Maximum value of one attribute within a group based on another attribute
I have two attributes, name and revision, with revisions being related to the name. I.e. if the name is Checklist1 every time a user edits it they create a new entity ‘checklist’ with the revision number being one higher than the previous. I have a data grid on an overview page for the checklist entity, but I’d only like to show the latest revision of any given checklist name, since the rest are just there for archive purposes anyways. My gut tells me I need an xpath or a microflow to populate this grid, but in either case I have no idea how to structure it. Which method should I use and how should I structure it?
If I understand correctly, I would structure it this way:
lets say the parent entity is called Document and the version entity is called Version
have a 1 to many association between Document and Version, it will be called Version_Document by default when you create it. This will point to all versions of a document
create a second association between Document and Version that is 1 to 1, rename this one LatestVersion_Document, this will point only to the latest version
when you create a new version, be sure to populate the association LatestVersion_Document with that new version, also populate the Version_Document association
in your datagrid, you can display Version objects for the latest version using the following XPath, [LatestVersion_Document/Document] This will display only the Versions that are the latest version