25
Views
5
Solved
###### Make 2 filters for 1 list
Question

Hey everybody,

I am new to outsystems (rookie) and i have a question. I have a list with companies. I want to filter on name of the company with an input (text) and filter on rating 0-5 stars. i made the filter for the company with a refresh data. but the rating is this a problem. Can somebody help me and explain this.

Thank you!

Solution

If you want to be able to filter by both filters you should apply two filters to the aggregate,
having two local variables (one for the name searched and other for the choosen rating),
for example: local variable text: "NameSearched" ; local variable integer "RatingFilter" and supposing you give the default value for the rating filter -1, meaning whenever you don't pick a rating to filter the value of the variable is -1.

On the aggregate where you query the companies apply these filters:
1 - NameSearched = "" or Company.Name like "%NameSearched%"
2 - RatingFilter = -1 or Company.Rating = RatingFilter

This way, it will filter only by name, or only by rating or by both.

Champion

Hi Stefan,

can you share the oml or share some print screens of your code?

Regards

Here you are, Thanks for helping!

Champion

It should be like Bogdan stated below, you need to include a filter for the rating too.

I cannot see in the aggregate where that column is but adding something like Atrium.Rating = RatingFilter should do the trick.

Solution

If you want to be able to filter by both filters you should apply two filters to the aggregate,
having two local variables (one for the name searched and other for the choosen rating),
for example: local variable text: "NameSearched" ; local variable integer "RatingFilter" and supposing you give the default value for the rating filter -1, meaning whenever you don't pick a rating to filter the value of the variable is -1.

On the aggregate where you query the companies apply these filters:
1 - NameSearched = "" or Company.Name like "%NameSearched%"
2 - RatingFilter = -1 or Company.Rating = RatingFilter

This way, it will filter only by name, or only by rating or by both.

Thank you guys!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.