Hello everydody,


I have a table records showing car reservations created and a column that shows the Date Start and Date End of the reservation. 

For this i want to make a filter by Date Start and Date End and i am having some difficulties. What is the best way to do that and how can i do it?

I alredy tried to use DateTimeToText function but the records don´t show and the filters doen´t work.

Can anyone help me?


Thank you,


Pedro Santos

Hi Pedro,

It depends on what you want your filters to do and where you're reading your values from, but whether you're using user input to pick dates or dates that you already have, you shouldn't have to use DateTimeToText - you can compare two dates in Outsystems without converting them to text.

Can you give us some more background on what you're trying to accomplish with your filters? If you can share your screen and logic, that would be helpful as well.

Afonso Carvalho wrote:

Hi Pedro,

It depends on what you want your filters to do and where you're reading your values from, but whether you're using user input to pick dates or dates that you already have, you shouldn't have to use DateTimeToText - you can compare two dates in Outsystems without converting them to text.

Can you give us some more background on what you're trying to accomplish with your filters? If you can share your screen and logic, that would be helpful as well.

Hello Afonso,


Thank you for the quick response.

Here goes the filter logic and screen.


Pedro Santos


Solution

Hi Pedro,

I'm still not completely sure about your goals, but I'm going to assume that you want the user to be able to search by date like he's already doing with your Employee/Status search field. For the sake of an example, let's say that you want a date filter so the user only sees records where the selected date is within the Date Start and Date End:

1. You create a text input like you did for the Employee/Status search, but also include an Input_Calendar widget from the RichWidgets espace, and point it to your input. This will make it easier for the user to select dates with the correct format.

2. You go to your aggregate and add a condition to filter for records that have a Start Date before or equal to the selected date, and a Date End that is equal or after the selected date. You also need to remember to deal with an empty date field in case the user doesn't want to filter:


Hopefully this makes it more clear.


Solution