Adding multiple objects on the same screen

0
Hi there, I'm new to Mendix.  I'd like to add more than one object at once, which are products in my case, while being on the same pop-up page.  My current situation: After I add an object in a data view, it automatically closes and saves just one object.  I'm able to add an object with an Add-button which can be found on my template grid.  Should I solve this problem with a microflow?  Thank you. 
asked
2 answers
0

If you want to create a second object after saving the first, create a second button (Save + Next or something) to call a microflow. In this microflow simply commit the object, close the page, create a new object and open the same page again with this new object as parameter.

If you want to add multiple objects at once, you can do a hard coded amount of objects by using multiple dataviews on a single page. Put all these dataviews in a single dataview. Populate this dataview with a new entity that has a 1-* association with product. Fill each product dataview with a datasource microflow that simply creates a new empty object and sets an association with the entity used for the overall dataview. When saving, use this object as parameter, retrieve all products and commit them. Remove the overall data object.

If you want to be flexible you could also try a listview where you use buttons to add a new object straight in the overview with empty values that you can edit directly in the overview page. Think about saving and validating data though.

answered
1

It all depends a bit on what you want to do in this form. But when creating a complex form (ie with multiple nesting dataviews) it is indeed better to start with a microflow create all the new objects and set the references to the main object and then open the complex form.

Hope this helps, otherwise elaborate a bit on what the form should do.

Regards,

Ronald

 

answered