27
Views
9
Comments
Solved
How to correctly add versions to records of a entity and navigate through them
Question
Application Type
Reactive
Service Studio Version
11.54.78 (Build 63596)

Hi OS Community,

I have a table in my main screen that only shows the Version Nr 1 of a project, when the user clicks in the ProjectName it opens a popup where the user can select the version he wants to be redirected to.


The problems I am facing are:


  • I want to only show in the main table the most recent version of each project, but when I tied grouping the agreggator by groupId and use Max function for VersionNumber it only shows me one record per page
  • When the popup open it does not refresh the list of versions immediately, I need to click twice or else it will show the versions of the last clicked project.
  • When I click in a version it always shows the 1st version of a project, it does not show other versions.
  • When adding a new version to a project, the VersionNumber is always 1 instead of adding 1 to the highest version number for that project.

    If anyone could give me insights on this one I would be grateful, the .oml is attached.
ProjectManagementApp.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Declan Cole ,

1) if you are creating a new record in the project entity for every new version, I'm not really getting why you need the version entity, the project itself will hold your versions, right.  so just have a versionnumber in there.

2) to facilitate easily selecting the last version of every project, add a boolean to your entity IsLastVersion.  Whenever you add a new version, set it to False on the one that no longer is the last, and set it to True on the new one.

Dorine

UserImage.jpg
Declan Cole

You are right, I don't know what I was thinking, thanks for pointing that out.

And the number 2 point is also a great and simple solution to solve my problem, thanks a lot Dorine.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Just to make this more complete, there is a real good case to make for having a Project and ProjectVersion entity, but in that case, you should not add a new project record every time you add a new version.  The project would then contain information that doesn't change with every version.

That would be a one to many (so reference attribute ProjectId in ProjectVersion), and you could still use an IsLastVersion Boolean on the version entity, or alternatively you take the Espace + EspaceVersion as an example, and you have a reference attribute in Project to ProjectVersion, named LastVersionId.

2026-01-15 03-18-59
Vijay Malviya

Hi @Declan Cole 

I don't understand why you did this. If you want to add a project against a version then why are you trying to add the project id in the version table?

UserImage.jpg
Declan Cole

Hi Vijay,

because when creating a new version, in reality it is also creating a new record in the project entity. I did it this way because every project can have 20 or more different version and I want each one to be stored as a new project record since it will store information related to that project and related to that specific version. 

2019-01-07 16-04-16
Siya
 
MVP

This is how your data model looks like. Please consider having a ProjectVersion entity having (Id, ProjectId, VersionId)

Or Just like this.

UserImage.jpg
Declan Cole

But even when I changed the database structure I am still facing the same problems. For example, I want to display the ProjectName, Description and Creation Date in the main screen table for the latest version of each Project. The agreggate feeding that table with group by: ProjectGroupId and Max of VersionNumber is not giving me the correct output, do you have any solution for this?

ProjectManagementApp2.oml
2020-11-25 10-45-32
Mostafa Othman
Champion

Hello Declan,

Vijay is correct, why you are using key of both entities into each other.

By the way I see this relation is 1 to many relationship (one project have multiple versions) so you can use project Id only into Version entity.

You can make all fields that will be changed with each version into version entity and make project entity contains only ProjectId and ProjectName

2026-01-15 03-18-59
Vijay Malviya

Hi @Declan Cole 

I think you should try something like this


2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Declan Cole ,

1) if you are creating a new record in the project entity for every new version, I'm not really getting why you need the version entity, the project itself will hold your versions, right.  so just have a versionnumber in there.

2) to facilitate easily selecting the last version of every project, add a boolean to your entity IsLastVersion.  Whenever you add a new version, set it to False on the one that no longer is the last, and set it to True on the new one.

Dorine

UserImage.jpg
Declan Cole

You are right, I don't know what I was thinking, thanks for pointing that out.

And the number 2 point is also a great and simple solution to solve my problem, thanks a lot Dorine.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Just to make this more complete, there is a real good case to make for having a Project and ProjectVersion entity, but in that case, you should not add a new project record every time you add a new version.  The project would then contain information that doesn't change with every version.

That would be a one to many (so reference attribute ProjectId in ProjectVersion), and you could still use an IsLastVersion Boolean on the version entity, or alternatively you take the Espace + EspaceVersion as an example, and you have a reference attribute in Project to ProjectVersion, named LastVersionId.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.