Two datagrids - struggling to update one entity object with data from a second entitys object (they cant see each other)

Problem summary: I have two datagrids on a wizard page. They are both nested within a dataview. The one datagrid cannot use objects from the other datagrid. How do I work around this “context” problem?   The detail: I am building a web application that supports a brainstorming workshop. There is a user story that goes, “As a facilitator I want to merge one-by-one the brainstorm ideas from each delegate into the summarized list of Ideas for the entire workshop, choosing the appropriate summary idea to append the delegate’s idea to”.   I have a dataview for the Workshop attributes. Nested inside that is a Delegate datagrid listing the Delegates who are attending the Workshop. The Facilitator selects the Delegate from the datagrid and another datagrid “DelegateIdea”  (by association through DelegateIdea_Delegate), displays the Ideas captured earlier for that Delegate.    Then there is another (editable) datagrid that allows the Facilitator to edit the summary list of ideas for the Workshop. This datagrid is also nested under the Workshop dataview. But it is a sibling of the DelegateIdeas datagrid.   It seems that because these datagrids are siblings, they cannot see each other’s objects. So when I try to merge a DelegateIdea into a WorkshopSummarisedIdea, I am unable to. The WorkshopSummarisedIdea datagrid cannot see values from the DelegateIdeas grid.   I have tried building dataviews that listen to the datagrid. No joy. I have tried microflows but they too can’t see the context of both datagrids simultaneously. I have trawled the documentation and see that perhaps a microflow as a data source might do it, but I can’t figure this out to confirm or disprove it.   I know this a long explanation, but I hope it makes sense.   Can anyone steer me in the right direction?   Thanks in advance for your time and expertise.
1 answers

From your description, it sounds like you are trying to reference data from two data grids in a Mendix page, where each grid is contained within its own DataView.

By design, Mendix context works in such a way that it restricts access to data from one nested DataView to another. That is, you can't directly access data from two sibling DataViews. A workaround to this problem could be using a microflow that pulls in necessary data from both DataViews.

Below are the steps you can take to solve this problem:

  1. Create a Microflow that takes the 'Workshop' and 'Delegate' as input parameters.

  2. In this Microflow, Retrieve the DelegateIdea associated with the Delegate and the WorkshopSummarisedIdea associated with the Workshop. You can use 'Retrieve Objects' activity in the microflow to retrieve this data from the database.

  3. Now, you have to Pass this data to your page. For that, you'll have to create a Non-Persistable Entity (let's call it 'NP_Entity') with associations to both DelegateIdea and WorkshopSummarisedIdea.

  4. Create an object of this Non-Persistable Entity in your microflow and associate the retrieved DelegateIdea and WorkshopSummarisedIdea with it.

  5. Then, Change the context of your page to this Non-Persistable Entity. Instead of directly placing your datagrids inside the DataView, you'll now place them inside a DataView that takes NP_Entity as its context.

  6. Now, inside this DataView, Create two nested dataviews, one for DelegateIdea and another for WorkshopSummarisedIdea. Place your datagrids inside these dataviews. Since they are associated with NP_Entity, you should be able to access the data from both the grids.