Hi! I’m wondering about best practice for building my datamodel.
I have an object class “Project” and several other object classes referencing “Project”. Is this best practice, or should project be referencing these other classes?
Example of classes referencing “Project”: “unit”, “event”, “task”, “document”, “equipment” etc.
I run into problems when trying to create a “Project overview”. When using a table, I can only have columns which exist in the Project class, thus cannot show events in the table (since event is referencing project and not the other way around).
So I created my own table using an iterating container. The container iterates “Project”. Now the problem is filtering. I would like a “Search filter” where you can search and filter based on all properties of “Project” including object classes referencing “Project”. Example if input in search field is “Equipment 1” then only Projects containing “Equipment 1” should be visible. Conditional filtering for the iterative container only allows for filtering of “Project”, not classes referencing project
If there is no many-to-many-relation between “Projects” and the referencing object classes, you could use a runtime property with a function to display the referencing object classes on “Project”. In the function you return the referencing object class which matches the project (in context). So for example you add the “event” data source as a parameter with a filter where event.project equals project (in context). If a project can be referenced to many events, you have to aggregate it (depending on what you want to display). You’ll find in the documentation an example on how to aggregate: Functions - Appfarm Documentation.
Can I define the relationship?
As far as I can tell all relationships are single-to-many, i.e. one project but many events (and events can only be assigned to one project).
Here is one of the relationships:
Here is my attempt at making a runtime property of unit with a function to Convert an array of objects into acomma seperated list