Pass multiple entities to a snippet - Mendix Forum

Pass multiple entities to a snippet

34

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
3 answers

Hopefully, the planned feature to pass multiple entities to pages will be introduced to snippets as well.

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