1180
Views
11
Comments
Solved
How to filter data in Aggregate with 2 different filters
Question

Hi Folks,

I am developing an app of Reactive Web type. I have used 2 Table widgets in a screen and data source for those tables(screenshot below) is an aggregate. All the fetched records are going to be same in both the tables based on a filter which is different for both. So I'm trying to use only one aggregate and trying to filter the records based on this different filter but I'm not able to create filters separately for these tables. Is there a way to achieve it? PFB screenshot of tables:

Eg. Aggregate Name = GetBookings

Thanks,

Sanjay

2021-04-08 11-10-22
EFreitas
Solution

I created in a traditional web application, but you have ListFilter in server and client flows.

In a reactive application, you can filter the aggregate inside an action that is called OnAfterFetch (check the aggregate properties). Instead of using the result of ListFilter action, you can also "save" the result in 2 local variables (one for each table).

2024-06-19 07-19-32
JitendraYadav

Hi,


So first all you need is data from the database using aggregate and then use list filter action based on your requirement.


Thanks


.


 

2021-04-08 11-10-22
EFreitas

Hello Sanjay Kumar Sahu,

You can achieve that by doing an Aggregate (without filters) and use the system server action ListFilter to get both filtered lists. In each table you can use the result of each ListFilter.

2020-07-29 19-08-40
Sanjay Kumar Sahu

EFreitas wrote:

Hello Sanjay Kumar Sahu,

You can achieve that by doing an Aggregate (without filters) and use the system server action ListFilter to get both filtered lists. In each table you can use the result of each ListFilter.

Thanks for the quick response EFreitas. If you could also explain how can I use it in screen that will be great help.


2020-06-08 06-48-23
Divyanshu Pathak

Hi EFreitas,

Thanks a lot for the answer. Even I was thinking of the same question. I have been using a bad practice by making 2 aggregates for it.

Regards,

Divyanshu

2020-06-08 06-49-12
Rajat Pal

Good Question. Thanks for the answer EFreitas.

2021-08-12 11-00-27
Nordin Ahdi
 
MVP

Hi Sanjay,

All good suggestions are already given.

Let me share another way you can achieve this.

  • Create a Block with your TableWidget and its Aggregate. 
  • Create an Input Parameter of type Boolean (for example Is<TableName1>) for your Block
  • Create a conditioned filter (for table 1 and table 2) based on that Input Parameter inside your Aggregate.

Now you can put two instances of that Block on your screen, for table 1 you pass True to the Input of the Block and for table 2 you pass False.

Hope this helps!

Regards,

Nordin

2020-07-29 19-08-40
Sanjay Kumar Sahu

Nordin Ahdi wrote:

Hi Sanjay,

All good suggestions are already given.

Let me share another way you can achieve this.

  • Create a Block with your TableWidget and its Aggregate. 
  • Create an Input Parameter of type Boolean (for example Is<TableName1>) for your Block
  • Create a conditioned filter (for table 1 and table 2) based on that Input Parameter inside your Aggregate.

Now you can put two instances of that Block on your screen, for table 1 you pass True to the Input of the Block and for table 2 you pass False.

Hope this helps!

Regards,

Nordin

Thanks for the response. Seems little difficult, let me try it if I can implement.

2021-04-08 11-10-22
EFreitas

Check the images bellow.

Get bookings list:

and after you can use it as the source of your table:

2020-07-29 19-08-40
Sanjay Kumar Sahu

EFreitas wrote:

Check the images bellow.

Get bookings list:

and after you can use it as the source of your table:

A small doubt, is it a client action or server action? did you create above action in reactive web app ?


2021-04-08 11-10-22
EFreitas
Solution

I created in a traditional web application, but you have ListFilter in server and client flows.

In a reactive application, you can filter the aggregate inside an action that is called OnAfterFetch (check the aggregate properties). Instead of using the result of ListFilter action, you can also "save" the result in 2 local variables (one for each table).

2020-07-29 19-08-40
Sanjay Kumar Sahu

After lots of trial and error I finally figured it out. I used 2 ListFilters(one each for check-in and check-out) and 2 Output parameters and mapped output parameters source to ListFilters output. It worked fine.

Thanks All for your helps.

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