Having a list using a microflow data source update itself

1
Hello! Can I somehow make a list using a microflow as data source refresh itself? I like the to user to be able to choose products (left side) and add these to an order (right side). The product list should only show products not yet referenced by any order item (selected products). I now have a microflow as data source to filter out products already referenced. But the list does not call the microflow when products are selected and the view should change. I'm a newbie with Mendix so any ideas on how to accomplish this are more than welcome! (Order<--OrderItem<--Product)  
asked
2 answers
5

Tom,

In addition to Austin's approach, you can accomplish this without using microflow source ListViews as follows:

To Start, the domain model should look like this:

Then, your Order edit page should look like this:

The Xpath behind the Product List View is as follows:

This XPath indicates that only products that are not currently associated to this order should be displayed.

Finally, the Add to Order microflow is as follows:

BTW, the Commit Order causes a page refresh after a product is added.

The Remove From Order microflow looks like this:

This accomplishes your objective and uses fewer microflows, but instead relies on XPath to retrieve the correct items in each nest List View.

Hope that helps,

Mike

answered
0

Hi Tom,

You can accomplish this by using non persistent entities. I would create one entity as the caller of your page, lets call this "dashboard". Then you would create associations from "dashboard" to order, Product, and OrderItem. 

 

1. Before the page is opened

Use a microflow to display this page. In this microflow retrieve the order, orderitems and product. Create the dashboard object and associate the order to it. Then filter out the unused products and associate those products to your dashboard. Also associate the order items you want to display on this page. 

2. change your page 

Make the caller of your page the dashboard object, and display your two lists with data source over association using the dashboard objects associations. 

3. change your microflows 

In your microflow when a product is selected, you can run whatever logic that needs to be run, and to remove it from the list that is displayed to the user, just set the association to the dashboard to empty, and use the refresh in client option in the change activity for the dashboard object. (this will update the page for the user).

 

The parameters for your microflows will change. Just pass the dashboard object to them and you can retrieve the order object with retrieve by association. 

answered