Passing a two entities to a microflow to create an association.

Hello, I have a domain model with exam entity and question entity where many questions can associate with one exam. I have a way of creating questions in an exam, but what I hoped to do next was create a question pool, where I can multi-select unassociated questions in a data grid to associate with an existing exam. So I imagined a drop down choice of an exam to select and then a multi-select of questions on the page, and then being able to press a button to pass the selected exam and list of selected questions to a microflow to associate the questions with the exam. I think the microflow will have to accept two input paramaters (the exam and the list of questions) but I can't see a way of passing both an exam and list of questions from a page. I can only see how to pass one parameter. Please does anyone know a way of achieving this, if it is possible in Mendix? Thanks, Alex
2 answers

Hi Mike,

Thanks for your answer. I have it so a question can only appear in one exam, with the domain model a one-to-many, so I would use the pool to disassociate from an existing exam and then associate unassociated questions to a new exam. As someone would only be given a second exam if they fail the first so I don't want to allow the same questions in multiple exams.

I was trying things in the meantime since and found a way which works. Having a datagrid of exams from database, then below it a dataview listening to the exam datagrid. Then within that dataview a datagrid of questions from database. 

So I can select an exam then multi-select questions and press a button in the question datagrid which calls my microflows and passes both the exam and question list as paramaters.




One thing that's not clear from your question is whether a given question can appear on more than one exam - if so, that would mean the association between Exam and Question entities would need to many to many.

If that's your domain model, you can do this with a standard Mendix page without the need for a microflow.  Create a Master Detail page using the new page wizard.  The Master would be a list of Exams, the detail would contain a Reference Set Selector of the questions for the selected Exam.  Just be sure to commit changes when the question list is changed for an Exam.

Hope that helps,