apply filters in the data section

Hello, I will explain my request:

I inserted a list of values via URL in the Grid, calling a method present in the RestApi ("rest / RESTAPI1 / RESTAPIMethod1").

now I want to apply a filter in the list (the keyword must be entered from the keyboard) so that once the "search" button is clicked an action is triggered that applies the filter in the list and updates the Grid.


is it possible to apply the filter and reload the filtered data in the grid?



Thanks.


Mario.



Hi Mario!


Yes! You need two things: 1 - Refresh data model and 2 - Ajax refresh.


In 1, your screen must have a preparation for load the data from agregate. This agregate must have a filter like this: Table.Attribute like "%" + searchword + "%". This command is responsable for search the seachword in any part of the attribute text. In the search button action, you will need to a refresh table for this agregate in preparation. This will be responsable for redoing the agregate applying the filter with search word.


The second point (2) is the ajax refresh in your table for refresh the content.


Cheers!

I created an action called Action1 which is called by the SEARCH command.

inside there is the aggregation filtered and assigning the aggregation to the output variable (grid updated) (as in photo)


"in1" contains the keyword I use for the filter, it has the same value as the searchkeyword variable.


Now how can I use the updated grid?

Thanks.

Hi Mario, 


If I understood correctly, what you want to achieve is to have a aggreate with some data and when you click on button search, it filters a specific attribute of that aggregrate with the information in input (your In1 input parameter). Is that it?

If so, the best approach is following Thiago's advice. 

Step 1: you have a preparation with that aggreggrate. 

You can define a filter like this to search for an attribute containing the keyword: [Aggreggate_Name].[Atribute_To_Filter] like "%" + keyword + "%" 

If you want to match the keyword introduced with the attribute you can do:  [Aggreggate_Name].[Atribute_To_Filter] = "" or [Aggreggate_Name].[Atribute_To_Filter] = keyword. In the first time you access your screen it presents all the data of the aggregate, and then on search button selection, filters a specific attribute with that keyword


Step 2: Following the example you have, on Action1 you just need to pass the keyword as an Input Parameter and use a refresh for the aggregate and an ajax refresh to the container that envolves that aggregate (for example).


Hope it helps.

Best regards,

João Campos

the first aggregate I need to update the chart at the bottom of the page (but it's not important now).
"ActionFilterGrid" (I renamed Action1) applies the filter that I input and returns the updated list.
finally I use a "refreshGrid" with a URL connected to the grid updated as indicated on the screen.
as a result it gives me a grid with all the data, where did I go wrong?


That action "ActionFilterGrid" does the same as the one above "Action1"?

Mario,

maybe a good ideia you do this course: https://www.outsystems.com/learn/courses/114/developing-web-apps-outsystems-11/?LearningPathId=2

In this course have a part explaning your question, but demands more study time.

Anyway, i will try explain in more detail:

1 - your screen list needs a preparation with agregate to load the data, right? For example: GetFoglio, will return all data and list it in your screen. This agregate must have a filter with the keyword, like this example:


2 - In the screen, you have a button search with an action. This action will refresh this agregate (refresh data component) and your linked agregate table (ajax refresh component) in the screen, like this:


When you refresh the agregate in preparation, the keyword will contains the search content, then this action will aply the filter with this content. The ajax refresh will refresh the tabla with the new data.

Joao,  it does the same thing as above

Thiago,

the grid takes the data from a method in the REST (in logic). Data is sent to the grid via a URL. In the search (in the interface) I use SECTOR the "Data purchases" and "ajax refresh" shows me the Empty grid.


in my "RefreshGetFoglio1sBy Supplier" when I apply the filter it only updates the graph because the grid and the graph take the data from two different ovens. the grid from the method in the REST and the graph from the "GenerateSeries" action.