How to make the list/list item have distinct records?

How to make the list/list item have distinct records?

  

Hi everyone.


I'm currently at a dead end here. I'm developing a mobile application that has Drawing, Material, Activity and Location tables, where:

  • 1 DrawingNo can have multiples MaterialTagNo
  • 1 MaterialTagNo can have multiples ActivityNo
  • 1 ActivityNo can have multiples Location


I'm currently trying to create a function where I can detect the location history of a MaterialTagNo. After I search the desired MaterialTagNo that I want to view, the List shows me both the same MaterialTagNo. How can I make it show only one of the same MaterialTagNo? It might occur because it has 1 same DrawingNo and 1 same MaterialTagNo, but 2 different ActivityNo and 2 different Location. I already join all the tables with 'Only With'.

Not fully comprehending your issue here.

If you want to see the joined rows of 1 MaterialTagNo then why not filter on that id?

I.e. If you want to have a full list of material showing the joined data (activity/location) you will retrieve them in seperate rows when you join them.

You could query for material and query the details of a single MaterialTagNo seperately using a filter on the second one. 

Could you explain your visual screen challenge here? What are you trying to achieve?


cheers,


Roeland

Hello, smile :)

I'll start asking what is your knowledge on OutSystems, Data Modeling and SQL?

Also, what's the problem? 

Are you concerned that the join are repeating values in the aggregate? This is the standard and expected behaviour wne doin join that finds more than one match between two entities.

Or are you trying to show information on a table records in the screen, but don't want to show repeated information for the repeated data, something like when we do a "merge" in the Excel to show in one of the columns the data only once for the multiple values for that info?

something like:

Drwing 1, Material 1, Location 1
                      Location 2
                      Location 3
          Material 2, Location 4
                      Location 5
                      Location 6

The easiest way to do this is to do a list that will look for Drawings, and in the line, put a web block with a list of Materials, and in the line of this list, put a web block with the list of Locations (and so on).

But depending on the number of lines (Drawing and Material) and dependingon the number of users, this can become seriously slow.

Other options involve using a single aggregate and logic/UI that takes care of not showing repetitions.

Cheers,
Eduardo Jauch

EDIT:

I have here an example of this case:
https://eduardojauch.outsystemscloud.com/CategoriesAndItemsSameTable/Home.aspx?_ts=636487720717925933

Roeland Deichsel wrote:

Not fully comprehending your issue here.

If you want to see the joined rows of 1 MaterialTagNo then why not filter on that id?

I.e. If you want to have a full list of material showing the joined data (activity/location) you will retrieve them in seperate rows when you join them.

You could query for material and query the details of a single MaterialTagNo seperately using a filter on the second one. 

Could you explain your visual screen challenge here? What are you trying to achieve?


cheers,


Roeland

I'm sorry if my question is not that clear.

Here's the Locate screen where I want the MaterialTagNo to be distinct:


And here's the aggregate of the list above:


When clicking the list item, this will appear:


I don't have a problem with the second screen, it's the first one that I want the list to be display as distinct. I don't mind if the aggregate has duplicates, I just don't want the duplicates to be displayed on the list.


It just occurred to me that maybe if the aggregate for the first screen is GetMaterialsByLocation and the second screen is GetLocationsByMaterialTagNo, will it work?

Eduardo Jauch wrote:

Hello, smile :)

I'll start asking what is your knowledge on OutSystems, Data Modeling and SQL?

Also, what's the problem? 

Are you concerned that the join are repeating values in the aggregate? This is the standard and expected behaviour wne doin join that finds more than one match between two entities.

Or are you trying to show information on a table records in the screen, but don't want to show repeated information for the repeated data, something like when we do a "merge" in the Excel to show in one of the columns the data only once for the multiple values for that info?

something like:

Drwing 1, Material 1, Location 1
                      Location 2
                      Location 3
          Material 2, Location 4
                      Location 5
                      Location 6

The easiest way to do this is to do a list that will look for Drawings, and in the line, put a web block with a list of Materials, and in the line of this list, put a web block with the list of Locations (and so on).

But depending on the number of lines (Drawing and Material) and dependingon the number of users, this can become seriously slow.

Other options involve using a single aggregate and logic/UI that takes care of not showing repetitions.

Cheers,
Eduardo Jauch

EDIT:

I have here an example of this case:
https://eduardojauch.outsystemscloud.com/CategoriesAndItemsSameTable/Home.aspx?_ts=636487720717925933

 I'm pretty new to this and still learning. I have explained visually what my problem is on my recent reply. Thank you so much for helping me out on this.

Hello Smile :)

In the first aggregate, why don't you group by the info you want to show, including the id, of course?

You can do distinct with group by :)

Cheers

Eduardo Jauch

Hi both,

Eduardo's suggestion could do the trick.

What you might use in future could also do the trick.

  • Create a structure consisting only those fields of your need.
  • Create a OnAfterFetch action for the full aggregate.
  • In the action loop through the records using FOR EACH and fill a variable list of structure based on (IF) conditions to your need.
  • You can also assign this list of structure to your list.

cheers,

Roeland


Roeland Deichsel wrote:

Hi both,

Eduardo's suggestion could do the trick.

What you might use in future could also do the trick.

  • Create a structure consisting only those fields of your need.
  • Create a OnAfterFetch action for the full aggregate.
  • In the action loop through the records using FOR EACH and fill a variable list of structure based on (IF) conditions to your need.
  • You can also assign this list of structure to your list.

cheers,

Roeland


Hi Roeland, 

This will work also, but you are using extra-logic that can be time consuming, depending on the number of results, increase maintainability complexity, potential error points, etc.

If you can avoid this doing your query in a way that it returns exactly what you wants to show, it is better :)

Cheers,
Eduardo Jauch


Eduardo,

You're absolutely correct. It is always better.   

cheers,

Roeland

Roeland Deichsel wrote:

Eduardo,

You're absolutely correct. It is always better.   

cheers,

Roeland

Yet, it is important to have this possibility, as if you need to "process" the information prior to show it, you need/should to do this in logic ;)

Cheers,
Eduardo Jauch