Filtering the data when database is microflow

0
I have used microflow to retrieve the data from database and now I want to implement search functionality in it. Please provide a method to achieve the same.  
asked
4 answers
1

Hi Vasav,

you need to create a custom search functionality.

 

Refer the below medium link for reference

https://medium.com/mendix/create-your-own-way-of-filter-by-npe-non-persistant-entity-and-microflow-4ffd11e52fb0

 

Hope it helps!!!

answered
1

Hi Vasav

 

You would need to start by creating a helper entity for your filter (I suggest a non-persistable entity).

  1. Create the non-persistable entity called ‘Filter’ (for example)
  2. Give the entity the attributes you want to filter on with the corresponding data type: description would be a string; type could be an enumeration … 
  3. On the page where you want to display the data, add a filter header by passing a newly created filter object to a the page. You might need to create a nanoflow/microflow to navigate to this page now, instead of using the show page option if you are doing this.
  4. Place a data view widget on the page and put some input widgets in the data view for the items you want to filter on as such:
  5. Create a nanoflow which has an input parameter of the filter and a refresh object action as such:
  6. Add this nanoflow as an on change event for all the input widgets you have placed within the data view
  7. Important: from now onwards we are going to work in the microflow you have shown us
  8. In your microflow, add a parameter of your filter object
  9. After you have executed the query, you are going to add a list operation action, where you filter by expression. Here you have to determine your searching/filtering criteria. Therefore this step is very important! If you have multiple filtering criteria, you might have to add this action a couple of times for each criterium and do other list operations to merge the results (such as an intersect)
  10. Finally sort the list based on an attribute using the list operation > sort functionality in another action for cleaner results. It might look something like this if you replace the retrieve action by your database query (for two filter criteria): 

Let me know if you have additional questions or remarks. I tried to be as descriptive as possible, whilst still staying quite brief.

answered
0

There is an easier workaround and it may work in some cases you’re retrieving data from a microflow and need to implement searching capabilities from a Data grid.

We can do this by creating additional context for the Data grid using a Data view widget with Data source from the microflow, retrieving an object so we can constraint the data from the data grid.

 

  1. Instead of retrieving all data from the microflow, we should retrieve and object we use to make the final constraint later on.

  1. Then, on the page put a Data view with Data source from the microflow above. Inside, use the Data grid with Data source XPath, finally you create the final constraint to get your data, using the token '[%CurrentObject%]' to do so.

 

So, basically, we split the process of retrieving the data from a microflow to do the final activity on the page and not the microflow. 

answered
0

you can use data grid 2 and add column filters to it. 

answered