Hello!
I've got a problem. The records from the database are being displayed on screen.
they're not duplicated in the database. just when displayed.
Does anybody know how to solve this?
Raissa Domingos wrote:
Juan Carlos Elorde wrote:
Likely a problem in your joins in the aggregate. Can you show what it looks like?
Follow the image of joins.
You already have a Sector.FunctionalAreaId already. I am just thinking why you also have a cross join for FunctionalAreaXSector. There could just be a wrong relationship on this that is why it duplicates. What you can do is isolate your entities. Meaning, add entities as you need them.
EFreitas wrote:
If you want to show more than one announcements for each sector, you can achieve that by the following:
First create your sectors list.
Second, create an Block that shows the list of annoucements by sector Id.
At the end use that block in the first screen.
the annoucements are being displayed. but the sectors are stil duplicated. Do you think that could be some relationship that is missing or wrong?
You need to remove News entity from the aggregate. You only need to get the Sector list
As EFreitas said, you may need to remove some of the entities you don't need because this may be the cause of the duplicates.
Hi
In the aggregate you can group by one selected attribute, like a primary key (ID), this way you you will get distinct values. But it is important to understand why this is happen, probably some bad join.
I hope it helps :)
Is the DepartmentId a SectorId ?
Yes. it is!
What are the attributes that you want to show in the screen?
Did you already tried the group by solution?
I wanna show the sectors (in a list) and the annoucements of each sector, but they're look duplicated.
In this case, i think the solution above is the better to display the elements.
if you prefer, you can work with a list variable with a structure that you need to display in the screen, and at the preparation pass the records to list variable, removing the duplicateds, and use this variable like a source to list widget on the screen.
Hi Raissa,
If I understood your problem, I propose you this solutions:
SELECT ...
UNION
SELECT
Doing this removes the duplicates at the query level, and SQL Server will do the job for you.
I hope this help you.
Cheers,
Nuno Verdasca
If you use the group by, int the DepartamentId attribute, may will work well, but which elements you want display in the screen?
Leonardo Nascimento wrote:
It's not working. When I tried 12 error messages appear, and I don't even know how to solve, cause the logig used used is not mine, and i'm an outsystems newbie
Raissa, try the Distinct function, that I show you. When you pass the list as SourceList, it returns you a list without the duplicates. I think this is what you are looking for.Cheers,
Nuno Miguel Verdasca wrote:
I'm gonna try Nuno! Hope it works! Thank you
Which the attributes you need to display in the screen?
that I show you
Juan Carlos,
That cross join for FunctionalAreaXSector. It wasn't made by me. There's other people working on the same module of the aplication. And it's true, that's the cause of the duplicates. Thank you so much for the help!!
You can use this function too:
Before:
After
I had two MIGUEL and one Miguel, and I only had one of each. I know this is a simple example, but it works.Cheers,Nuno Verdasca