Hi Anisa,
I have done something comparable in the past. I always used an extra entity between (in your case) the event entity and the user entity. I call this entity Favorite.
I have a screen defined with two parts, one with an list of events and one with a datagrid of all favorites and it looks something like this:
The mendix page definition is like this:
Left you see a grid of all the events, with a listener to add, edit and delete events. I’m not explaining this part as it is standard mendix. The interesting part is in the Favorite dataview. I get the data based on a microflow: GetFavorite
This microflow will return a Favorite Object. If it is found based on a retrieval (see later) it returns the found record or a new record (ofcourse with IsFavorite set to false).
In the dataview I show the a button Make Favorite with visibility when isFavorite = false and a button Unmake Favorite with visibility when isFavorite = true
The retrieval is as follows:
The behaviour of the buttons are basically switch the isFavorite value, shown the microflow to Make a Favorite
In the second part of the page I show only the favorites for the current user and isFavorite = true (see data source)
This is a standard favorites solution. Hope this will help. If so, please accept my answer on the forum. I have not included deletion rules on the associations and any access rules. This should be included to make it more in line with standard / secured solution
Hi Anisa,
It looks like you have a custom User entity configured. This is in no way connected to the current user yet. Instead, you should make an association between Event and the System.User entity. You can then create a datagrid for Events on the page with an XPath that constrains the events to display with the Event.Favorite_User = [%currentUser%] assocation.
Hope that helps!