Adding an item of one listview to another by clicking on it (microflow)
I am very new to mendix, so sorry in advanced for my most likely poor understanding of the concepts in Mendix... I have a list view A in which items of type X are listed. Now I have another list view B on the same page in which I want to add certain elements of list A when there is clicked on them in the list view A. The data source of the list overview B is set to a microflow. This microflow is activated when clicked on an item in list A. The dataflow is structured as follows: -it retrieves a list of X from the database -it finds the selected item P on which is just clicked by a ‘find by expression’ -it creates a list C of type X -it adds item P to list C -the end event returns the list C Now I get the following error message: ‘Parameter ‘X’ of the selected microflow does not match available arguments. No arguments are available to B.’ I am quite stuck on how to solve this error message, would anybody know how I can fix this? In this image Friesproduct = X FriesProductList_2 = C Return_selected_FriesProduct = P
Sannerien van der Toorn
You get this error because you are using a microflow as source on listview B with input parameter X and you don’t have this parameter information.
There are a lot of possibilities how you can solve this, but here is a simple one .
Create a boolean attribute ‘Selected’ (default on false) on your entity X.
Create a microflow on click on listview A that has parameter X and change object activity on parameter X to set the boolean on True. (commit & refresh)
On your page you have listview A with a list of all object of entity X and a listview B with all objects of entity X with a constraint on Selected=True. If you now click on an item in listView A it will also appear in listView B.
Extra: if you want to remove the selected items from listview B you can create another on click microflow that changes the attibute of parameter X entity back to Selected=false
Here are a couple of things that I see:
List B has a datasource microflow (I assume its the same one that you attached with the issue) – The issue is that there is no way your microflow has context of object X (FriesProduct). You can only have this context when you click on the list view item and the only way to do that would be to have a data view listen to the widget (Listview A). Inside this dataview you can have the listview which has the datasource microflow that you created.
But, with point 1, everytime you would only have 1 list item in your list B (as at any given moment you will have context of 1 object)
I don't really know your use case – but do note that you can also pass a list of items if you require multiple objects to be passed to your microflow. You can set a datagrid to have multiple selection of items and then on click of a button you can add all the selected items to the required entity and show it on another page (to show it on the same page and refresh at the same time you may require a helper entity)
I hope this gives some insight. I'd also recommend to go through the rapid developer course as it will help with such concepts as well.