Filter data in a listview by selecting a range of dates

1
Hi all,  I am trying to create a filter on a listview.  This filter is basically a selection of 2 dates (Start and End), and I need to display the objects of the listview only if the field “date” of my object is inside the range. So I tried to create a new entity called filter that I linked to the entity that is listed in the listview, with 2 attributes : “Start Date” and “End Date”. In my page I created a new dataview of this object, with the 2 dates that I make the user choose, and then he clicks on a button that calls a microflow that commit the filter and refreshes it.  However, the problem is that my list view doesn’t update the datas loaded after this click, the way I did it it could work only if the microflow is called again, checking the dates of the filter object. I am not sure this way to do  is the right one, so is there anyone that has a idea in order to do this ?       
asked
5 answers
2

The easiest solution I see is to simply put the listview within the dataview of the filter object. Whenever you refresh your filter object (which you do when you press the button), the datasource microflow is triggered again as it resides within the dataview.

As a result, the filter object is available as parameter within the listview datasource microflow as well. So you don't even need an association in your domain model to get the right parameters. You can even do everything within one retrieve action, instead of using exclusive splits. For every search condition you can do this:

($Filter/DateFrom = empty
or
DateFrom >= $Filter/DateFrom)

and

($Filter/DateTo = empty
or
DateTo <= $Filter/DateTo)

answered
2

I would go for something like this: 

DS_DealsForFilter

 

Do make sure that the filter retrieves are reusable and when hitting the search button you fire the retrieve and set the DealList to the Filter and refresh the filter. That's it!

The filter is attached to session so when somebody logs of, your filter is deleted.

answered
0

Refreshing the FilterDate entity doesn't refresh the listview. 

Isn't it easier to add the startDate & endDate attributes to the Deal entity and then filter on it?

answered
0

Hi there, 

You can do like this 

 

 

answered
0

Problem is solved, indeed by placing my listview inside the Filter dataview, the list is correctly refreshing when I click on my Filter button.

Thank you all,

Dan

answered