Merge two lists to sort

Merge two lists to sort

  

Hi,

I am trying to build a mobile page with content from two aggregates. I added two lists to the page and sorted them by date added field.

It works although what i would like to have is the content of both in one and sorted. So I would have a page with the content mixed depending on the date added.

Right now i have the first content in the first list sorted and after that a second list with the content sorted but i would like a merge of the content and sorted.

Regards,

Joao

Hi Joao,

I think both aggregrates must have a same attributes.

Make a local variable of type of list of the aggregate and append both the aggregates to the local variable of type list.

Now after appending the values to the list pass the list to ListSort action in the system extension.

now you can pass the type of sort (asc or desc) and based on the (attributes) in that action.

I think it will resolve the issue. 

Hi Kirit,

Sorry i am new to outsystems. How can i do the list of the aggregate and append it to the local variable?

When i do a local variable type list asks for a specific list and the aggregates are not option.

Regards,

Joao

Hi Joao,

Add a local structure which is having same attributes as the list that you are displaying in the screen.

and add a local variable of type of list of record of type of structure that you have created.

append the list from the first aggregate to your local variable and then append to same list from the second aggregate and then add the List sort action in the flow and pass the necessary parameters.

Let me if you still not clear.

Thanks Kirit.

Hi Kirit,

Do you mean a local structure with the common attributes that i want to sort by?

Regards,

Joao

Hi Joao,

Yes in local structures add a structure based on your table that your displaying on screen. 

Hi Kirit,

Ok and than how do i feed the local storage with the aggregate data?

Hi Joao,

If you want to have a single list that represents both types of data, you need a single datatype and a single List or Record List regardless of whether you want to sort  

You say you have two Aggregates: are the Entities in the Aggregates not combinable in a single Aggregate? If not, and you have two seperate lists of data that you want to show in a single List Widget, you need to identify all common elements that you want to show in the List Widget, create a Structure with these elements as Attributes, create a Local Variable of type List of the Structure, and ListAppend both Aggregate outputs to that List, mapping the values as needed.