How to filter data in Aggregate with 2 different filters

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

Hi,


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


Thanks


.


 

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.

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

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.


Good Question. Thanks for the answer EFreitas.

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

Check the images bellow.

Get bookings list:

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

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 ?


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.

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).

Solution

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.