[MOBILE] How to add filter in API

[MOBILE] How to add filter in API

  

I want to add filter in this API REST with outsystem without change the back-end, any way to do this?

Solution


Hi,

Do follow the below steps for the REST API & Filter:

1- Create REST API & create it's appropriate requires Entities in Local Storage from Structure.

2- Create a Data Action on Screen where you want to call the REST API

3- Add an aggregate for the Local Entity to the Screen.

4- The DataAction gives you onAfteFetch Event, where you have to define an action.

5*- In the action clear the  Local Entity by calling DeleteAll()

5.1- Validate your REST API result & then Dump it accordingly using ListAppend or List with CreateorUpdateAll() / CreateorUpdate()

5.2- Refresh the Aggregates 

6- Add Filter on Aggregate of Screen , whatever you want to filter, you can  also use GroupBy /Sort/ Distinct & Filters there.

Note: You can use the DataAction i.e you can call the DataAction Refersh on LayoutOnPullToRefresh Action.

Cheers.


Assif



Solution

assif_tiger wrote:


Hi,

Do follow the below steps for the REST API & Filter:

1- Create REST API & create it's appropriate requires Entities in Local Storage from Structure.

2- Create a Data Action on Screen where you want to call the REST API

3- Add an aggregate for the Local Entity to the Screen.

4- The DataAction gives you onAfteFetch Event, where you have to define an action.

5*- In the action clear the  Local Entity by calling DeleteAll()

5.1- Validate your REST API result & then Dump it accordingly using ListAppend or List with CreateorUpdateAll() / CreateorUpdate()

5.2- Refresh the Aggregates 

6- Add Filter on Aggregate of Screen , whatever you want to filter, you can  also use GroupBy /Sort/ Distinct & Filters there.

Note: You can use the DataAction i.e you can call the DataAction Refersh on LayoutOnPullToRefresh Action.

Cheers.


Assif



5.1- Validate your REST API result & then Dump it accordingly using ListAppend or List with CreateorUpdateAll() / CreateorUpdate()

 for this step i still didn't understand after all, can you show me the specific example?


5- Follow this:


5.1 - Clear Local Table first

5.2- Create a Local List Variable of your Local table Type on Screen - lets say it MaNewsList 

       Drag a Client Action from LeftSide & Select List Clear Action & pass your List Variable MaNewsList  to it.

5.3-  Drag a Client Action from LeftSide & Select List AppendAll Action & pass your List Variable MaNewsList  to it.

5.4- Drag CreateOrUpdateAll Action from LocalTable & & pass your List Variable MaNewsList  to it.

5.5- Refersh Aggregate


OK thank you