Having issue displaying exactly what i need in list widget

Hello im having a issue with getting a list widget on page PM1LocationAndDepartmentList.

I want my department list to show all departmentsByPropertyId that have a LocationItemId and/ or a SublocationItemId. I feel like my problem is the aggregate GetItems but im not 100% sure. I can either get it to show all departments with or without a Items or it will show only the Departments with LocationItemId and it will mix my SubLoactionItems with LocationItems as seen in picture below. I have changed all kinds of joins and filters in the aggregate to get it to display all department that have a item attached but failed.

It very well could even be the way if have the architecture below is a picture of the entity diagram.

I also tried included a attachment of the program if someone wants to open it to take a better look but havent figured out how to make the example a .oml file all i get is a .oap file?!. If you have any questions let me know and any feedback would be much appreciated. Thanks

Hello Michael.

To attach the oml you go to menu Module -> Export -> Save As

Your issue is on the filters.If you set With or Without it will show empty rows. If you write Only With it will show only the ones with both.


From what I see, Department must have LocationItem or SubLocationItem to be connected to Property.
Therefore, by filtering on PropertyId it should limit to those filled in.

Great ill post a .oml tonight and mess around with the filters and joins and give another example. Im trying to get all the items from either location and or sublocation by propertyid and have them grouped by department name. I can only get it to Group departments with get items or sublocation items but not both without it wanted to link sublocation.locationid to the locationid and therfore not displaying all the sublocation items. 

Here is the .oml file thanks again

Another problem im having and would solve this issue above is a circular dependency between entities error. I got around the problem when i made a LocationItem entity and SublocationItem entity. I originally wanted it to be a Item entity and had a attribute for LocationId and SubLocationId but that was causing the circular dependency between entities error even with them not being mandatory. The only way i could get it to work was if the delete rule was on ignore but i cant have that because i need for the item to delete if the location or sublocation was deleted. And now im coming across it with other things i wanted to add to Item entity. Im not sure what im doing wrong im still new to learning this software so any help would be appreciated. 


Solution

Hello Michael.

Data modeling is not OS specific. You can learn from it in many different ways.


Your general concept is "I have a Property. Property has Location. Location has SubLocations."

Then Items should have a LocationId or SubLocationId. The delete rule doesn't need to have all the logic. You can do it in OutSystems and "when sublocation is deleted, keep Item with location only", "when location is deleted, delete item".


Regarding the query, your issue is that you have two pairs (SubLocationItem+SubLocation and LocationItem+Location) and you are treating it as one. For that to work, you need to use UNION (Advanced SQL) and your Ids will be a problem later.

You should really move ta a single Item entity.

Solution