Pass entity as filter to another aggregate

Hello All,

hope my post finds you healthy!

I appreciate your help in my below case:

I aggregate an entity named "Form" and i display it successfully to user.

The request is to pass through every id of this entity as filter to another aggregate in preparation.(the another aggegate is about another entity. The id is the only common point between the two aggregates.)

Any advise?

Hi George Mitsiou ,

why you are passing id ,

You can join between them,like below image


https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Handling_Data/Queries/Supported_Join_Types 


You can pass ID in specific case if you need only record based on Form ID.


Regards

Rahul sahu

Rahul Sahu wrote:

You can pass ID in specific case if you need only record based on Form ID.

 Thanks for your reply. 

How can i pass the ID to another aggregate(s)

 

Hi George,

You can pass id in filter condition like below image

with same datatype.

can you post your code what you want achive.


Regards

Rahul Sahu


Rahul Sahu wrote:

can you post your code what you want achive.


 I have the below aggregates

The Get_Customers is displayed to a table named "Customers".

In "Get_Services" aggregate i pass through the current id from Get_Customers.

 The request is to preview in Customers table the result of the second aggregate per every ID

Hi,

If I understand correctly, you just want to get common data from both the entity if yes just follow Rahul steps(First Response).


Thanks


JitendraYadav wrote:

Hi,

If I understand correctly, you just want to get common data from both the entity if yes just follow Rahul steps(First Response).


Thanks


 I follow the first approach but i something goes wrong. I can not get the ID for every ID

Any advise?

 

George Mitsiou wrote:

JitendraYadav wrote:

Hi,

If I understand correctly, you just want to get common data from both the entity if yes just follow Rahul steps(First Response).


Thanks


 I follow the first approach but i something goes wrong. I can not get the ID for every ID

Any advise?

 

 

 Yes bcoz of left outer join(With or Without), Use With only.


Thanks!

If still you are facing issues, Please share the OML(Module) file will help you.

Solution

HEllo George,

Let me try to help you

I may be wrong, but it seems that you have a list and want to show, for each item of the list (customer), you want to show a second list (services).

If you have a list, and you want to show, for every item of the list, another list, it will be really hard (if possible at all), to do that using two separate aggregates in the same scope.

The easiest solution is as follow:

In your page with the customer list, you will have ONLY the GetCustomers aggregate, that feed your screen list.
In the list, you will place a BLOCK, and will pass to the block the id of the current item, through an input parameter (YourListName.List.Current.YourEntity.Id).

In your BLOCK, you create another list, and in its preparation (block's preparation), you fetch the services, filtered by the customer id.

That's it.

The problem is that for every customer, you will have an access to the database, to fetch the services. This will impact negatively the performance. But any other solution would involve more complex logic/UI management.

Hope this helps.

Cheers.


Solution

Eduardo Jauch wrote:

HEllo George,

Let me try to help you

I may be wrong, but it seems that you have a list and want to show, for each item of the list (customer), you want to show a second list (services).

If you have a list, and you want to show, for every item of the list, another list, it will be really hard (if possible at all), to do that using two separate aggregates in the same scope.

The easiest solution is as follow:

In your page with the customer list, you will have ONLY the GetCustomers aggregate, that feed your screen list.
In the list, you will place a BLOCK, and will pass to the block the id of the current item, through an input parameter (YourListName.List.Current.YourEntity.Id).

In your BLOCK, you create another list, and in its preparation (block's preparation), you fetch the services, filtered by the customer id.

That's it.

The problem is that for every customer, you will have an access to the database, to fetch the services. This will impact negatively the performance. But any other solution would involve more complex logic/UI management.

Hope this helps.

Cheers.


 

 Thank for you reply. Please clarify what you mean with the "Block"

Hello George.

Did you went the online training? :)
If not, I recommend, as it is a very good way to learn about the platform.

A Block is a piece of reusable interface.
If you are working on a Traditional Web Application, it is called Web Block. Reactive and Mobile applications they are called only Block.

All the online training have videos explaining them, how to use, etc :) 


George Mitsiou wrote:

JitendraYadav wrote:

Hi,

If I understand correctly, you just want to get common data from both the entity if yes just follow Rahul steps(First Response).


Thanks


 I follow the first approach but i something goes wrong. I can not get the ID for every ID

Any advise?

 

Hi George,

In case you could not figure out it. Jitendra's suggestion is correct to filter it. Small correction on that, use ONLY WITH relation in between entity like below :

You will get only those services which have CustomerID.

Second aggregate should be like :

Services ONLY WITH Customer ( Source Section)

and in Filter : Services.CustomerID = Customers.List.Current.Form.Id

Also confirm that your second table(table for services), is bind with Get_Services.List

Hope it helps.

Thanks,

Sanjay