58
Views
6
Comments
Solved
 Filter data action data through server action (Reactive)
Question
Service Studio Version
11.54.24 (Build 62760)

I have a table with data that is populated by a data action. I want to make a filter for each input field, to filter by any data. The filtered results should appear in the table. Generally I apply the filters to the aggregate, but in this case I can only pull the data through a data action. So how do I apply these filters in this case?





filtro4.png
filtro3.png
filtro1.png
filtro2.png
Champion
Solution

Hello

Fetch the data from data action I suppose we  get the data from API it can be a Server Action or Service action as well, So once we get the data from it take an assign(Output Parameter) and store it. it should have list type variable of same data type, 

Once you get the data and you have assigned it, now add a on after fetch action and add a local variable type of list on a screen same as the output response data type of your data source.

Now assign the output of your data action to it.

We are done with data assignment part till now,

To filter the data create a action and first clear the local list by using list clear action, after that use a list filter action and add a condition over there.

Then assign the output of your list filter to the same local list attribute.

We are doing all list filter operations on Local list all the time and assigning back the output response again on rest action, The reason is to avoid server calls again and again, at start get all the data and perform, all of your filter operation on local list.

I have created a Sample for you, you can use it for a reference.

https://personal-ejuytnht.outsystemscloud.com/FixedMenu/Screen1

I hope this will help you

Best Regards
Tousif Khan

Sample_ List Filter.oml


Thank you, you helped a lot! 

Just one more question, in my case there are several input fields, one to filter each piece of data (name, address). How can I apply the filter to all these inputs with the same client action?

Champion

You can use Or inside your list filter,

Or you can add a switch after list clear and change your flow to different branch,

The best thing I will suggest you to use or after using each Index function.

Thanks

Tousif Khan

Hi vn_perpetuo,

If you can change your data action logic, add there input parameter for filters and fetch your data accordingly.

If it is not possible, use OnAfterFetch for your Data Action and apply filters there. 

Hey @vn_perpetuo ,

First take the "ListFilter" server action dependency.


Then use it to filter based on your desired condition and assign it to the output parameter.

For example I am filtering "GetProjects.List" and the condition is "Project.Question="abcd".

It will filter all the records having question ="abcd".

And I am assigning the output of "listFilter" to the "out1" varible


Thanks & Regards,

Sudip Pal

hello, vn_perpetuo.

As Sudip Pal said previously, I would use a ListFilter

Champion
Solution

Hello

Fetch the data from data action I suppose we  get the data from API it can be a Server Action or Service action as well, So once we get the data from it take an assign(Output Parameter) and store it. it should have list type variable of same data type, 

Once you get the data and you have assigned it, now add a on after fetch action and add a local variable type of list on a screen same as the output response data type of your data source.

Now assign the output of your data action to it.

We are done with data assignment part till now,

To filter the data create a action and first clear the local list by using list clear action, after that use a list filter action and add a condition over there.

Then assign the output of your list filter to the same local list attribute.

We are doing all list filter operations on Local list all the time and assigning back the output response again on rest action, The reason is to avoid server calls again and again, at start get all the data and perform, all of your filter operation on local list.

I have created a Sample for you, you can use it for a reference.

https://personal-ejuytnht.outsystemscloud.com/FixedMenu/Screen1

I hope this will help you

Best Regards
Tousif Khan

Sample_ List Filter.oml


Thank you, you helped a lot! 

Just one more question, in my case there are several input fields, one to filter each piece of data (name, address). How can I apply the filter to all these inputs with the same client action?

Champion

You can use Or inside your list filter,

Or you can add a switch after list clear and change your flow to different branch,

The best thing I will suggest you to use or after using each Index function.

Thanks

Tousif Khan

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