How to prefilter a datasource before a join in aggregate

Hello everyone, 

I am facing an issue since few days. I cannot find a solution to my problem, let me explain the context

I have a catalogue of tests that the user can select or not for a project. 

The catalogue has its own data source and for each project, when the user select tests, I am adding or deleting the tests in another datasource as an entity with the TestId and the ProjectId as external keys

My problem is now how to display on the project detail a list of Tests in the catalogue with a Button which display Select or Unselect. On the screen, I have an aggregate in the preparation supposed to get the catalogue of Tests. My first idea was to join it with the list of all the Tests selected for all the projects and to filter by project. But when I filter for the good project, I loose the full catalogue and get only the selected tests of this project

Do you have any solution to help me on this topic ? A way to prefilter an entity before joining it in the aggregate ? Or to join to aggregates ? Because If I use an attribute "IsSelected" assigned using a ForEach on the catalogue and a ForEach in the tests list, it will be not really efficient.

Thank you and have a great day

Hi Guillaume,

I have some difficulty understanding what you mean, talking about "datasource"s and such (that's not an OutSystems concept), but from the little I do understand, don't you just need a left join (a.k.a. "With or Without" in an Aggregate join condition)?

Hi Kilian, 

Yes I am using Datasources instead of Entities sorry. 

Let's go for an example : We have Test A, Test B and Test C in the Catalogue Entity

I want to assign to Project 1 : tests A and B

And to Project 2 : tests B and C

But when I will want to make a left join : The aggregate will show 3 lines : 

  • Test A, Id of the Project 1
  • Test B, Id of the Project 1 
  • Test C, NullIdentifier()

This will work with the 1st project but if I select a 3rd project and filter my aggregate with the Project 3, the filter will apply on the Test Entity and then I will only see the Test C, NullIdentifier() line because the first 2 tests are already linked with the project 1 and then not displayed by the filter

Sounds like you want to do a cross join. In an aggregate, that means not specifying a join condition at all (you'll get a warning, but the aggregate will work).

With the cross join, I get the warning but nothing is displayed from the catalogue ...



Lets Say you have the tables Project, Catalogue and ProjectCatalogues (this because is a n to n link between Project and Catalogue)

I would do an aggregate like this:

Catalogue with or without ProjectCatalogues = ProjectCatalogues.CatalogueId and ProjectCatalogues.ProjectId = <variable where you have the projectId you want to see>




Perfect Marcelo, 

Thank you for your help. I was already using the many-to-many relationship but I was filtering the global aggregate (Filter) instead of filtering the join link (Condition).