Hi! I have a preparation with an aggregate with a join with 3 tables. And I have a table records that has as Source Record List this aggregate "GetMovies.List". Now I would like to have 4 combo box to filter the table records based on the selected option in each of the combo boxs. Do you know how to properly achive this in outsystems? There is some example to achieve this properly?
Hi Jake,
Yes, you can do it very easily.
My example will be for Movie Type filter, you can replicate the same thought process for the others.
You first want to create a variable that will hold the value for the filter, let's call it MovieTypeId and set tht type to Movie Type identifier:
Then you want to drag the combobox to the screen binded to MovieTypeId:
On your query that fetches the movies, you will need to add the filter for MovieTypeId if one is selected:
Now on the combobox, you want it to add a hook on the OnChange:
And on the OnChange action, you just need to refresh the query and the table part of the screen:
And that's it!
Hope it helps.
Cheers,João
Thanks, on the preparation, in the filters it shows in the filter MovieTypeId = NullIdentifier() or Movie.MovieTypeId = MovieTypeId, a warning "You are comparing and identifier with a different type". Do you know why? Thanks!
And I created in the combobox special list the value1 "0" and in option 1 "All" so the user can select "All" to show all movies. But when the user accesses the page it firts it doesnt show all movies. I need to click in the "Reset" button for the movies appear.
The Nullidentifier() represents the null values for Numeric Ids, so if you have set the MovieTypeId to be of the type Movie Type Identifier and the id of that Movie Type table is an integer or Long integer, you won't have the warning.
Thanks, it worked. Also do you know when the user accesses the page at firts it doesnt show all movies. I need to click in the "Reset" button for all movies appear. I have also this filter:
Movie.title like "%" + Session.Movies_SearchKeyword + "%" or Movie.description like "%" + Session.Movies_SearchKeyword + "%".
If when you are entering the page, you are not seeing anything it probably means that some filter is being applied.
Can you check what are the values of Session.Movies_SearchKeyword and MovieTypeId when you enter the screen?
If the first is empty and the second one is nullidentifier() you should be seeing everything.
You can debug the query on the query on Preparation and see the values of these two variables on that moment.