I need help for creating a filter in Cuba Platform. Data Model is basically like this:
Entity : Talep name-----------------|---------type---------|---------cardinality---------
durum_bilgileri-------------Durum-----------------One-to-Many------
Entity : Durum name-----------------|---------type---------|---------cardinality---------
Let me explain all entity names in English. Talep means “Demand”, and Durum means “Situation” in English. One-to-many relation exists between Demand and Situation entities.
In Demand.Browse page, I have created a custom column named “Situation”. In this column, status of last Situation is shown. Last situation is found by date(createTs) property. In the background, “Situation” column is filled with something like
talep.getLatestSituation().getStatus()
I need a filter that shows the “demands” has the latest “situation” with given “status”.
Example : User selects status Finished.
Output : Demands have the latest situation with “Finished” status are shown to user.
I have a different solution also, add another boolean property to Situation entity. Set to True for the latest situation only. If you have different methods, I’d like to hear them too.
I would suggest using the additional boolean property for the latest Situation. A little denormalization always helps in queries. Your filter conditions will become trivial:
Join: {E}.situation s
Where: s.status = ? and s.latest = true