Pass multiple entities to a snippet - Mendix Forum

Pass multiple entities to a snippet

70

Now that it's becoming easier and easier in more recent Mx versions to use objects and attributes from multiple dataviews on a page, it's becoming more difficult to use snippets, since you can’t pass all these objects from a page to a snippet, you can only pass 1.

Example:

I have page with dataview1, another dataview2 inside, which has a listview1 inside. In the listview1 item, I use the object from dataview1 as input parameter for a microflow button, and use the object of dataview2 for conditional visibility.

Now I want to reuse the listview item stuff, so I want to make a snippet for this, but unfortunately, a snippet can only have 1 entity: the listview entity, so my microflow button and conditional visibility do not work in the snippet, because the dataview1 and dataview2 objects do not exist in the snippet context.

Solution:

Add multiple entities to a snippet, so I can pass the objects of dataview1 and dataview2 to the snippet.

asked
6 answers

Last week I’ve heard at the Mendix Product Roadmap meeting that this feature is announced for one of the following Mendix releases.

Created

As Mendix 9.18.0 is now allowing multiple page parameters it would be great if they could apply the same for the next lower level and allow multiple entities/parameters also for snippets.

Created

I'd also very much like to see this feature. As Mendix UI's become more complex you'll face this constraint more and more often. One place where this seems to happen especially often is with snippets in a list.

Created

I hope this idea will get noticed, especially with the recent introduction of multiple page parameters.


When extracting a part of a page to a snippet, it is more than likely that sections within that part are using data from other dataviews on a page.

Created

Same goes for passing more then one object to page.

Created

Like that idea. The current status forces you to decide between features:

using snippets vs. passing more than 1 entity as parameters

And these are the worst decisions you have to take as a developer: sacrifice functionality or maintainability for some other functionality.

Created