How is your experience with the OutSystems Community?
67
Views
8
Comments
how to merge two list in one
Question
Application Type
Reactive

Hello, I have 2 API responce one is "Et_Suprequestlist" and second is "Et_Qresp_List"

both having id field , so i created new structure named as MergedList and keep  id and other fileds from first list and second list .eg. List "Et_Suprequestlist" is having id, name,dob, etc and "Et_Qresp_List " is having id, status1, status2 , so my new structure is like id, name,dob ,Status1,status2 .i want to show the above mention fileds into data grid so for json searilization i want to merge both lists.  here my var1 is the new structure which i created and i append all elemnets form Et_Suprequestlist  to var1 so that my first lists elements on var1 only status 1 and status 2 is blank(rest of fileds are there), in list filter i keep my second list  i.e "ET_Qresp_List" and condition is like below 

 and then finally i am assigning the status 1 and status 2 values to var1 with respective Listfilters current element, but i am getting blank values for var1 status. can some one help me out for this issue. plz check the attched screenshots for buth lists

listb.PNG
listbupdated.PNG
2025-09-25 14-38-22
Lokesh Kumar Yadav

I am sending you the URL and the OML, so you will get an idea of how the logic will work.


The data is coming from the API, and here I have used an Aggregate. But you need to check one thing first — the second table/entity should have a proper connection and mapping with the first one. Only then will the values be filtered correctly.


MergingList 

MergingList.oml
2025-09-25 14-38-22
Lokesh Kumar Yadav

https://personal-udaksfpd.outsystemscloud.com/MergingList/MergingList?_ts=639162519840788448

2024-10-05 13-30-20
Huy Hoang The

you can use List Append_All and List_Sort

2023-10-21 19-42-11
Tousif Khan
Champion

I thing there might be something missing there, can you share the Oml or some more snapshots so that we can update the logic and share you the updated oml.

Thanks
Tousif Khan

UserImage.jpg
vikas sharma
Champion

Hi @Bharat koshti 

As you already using a loop to add list2 data. So I would suggest use loop on list1 and then use append in the loop to add the list1 element in the var1 and then list filter on second list, get element and add second list filtered data in var1 in same loop iteration.

Means you just use one loop and in that loop do assign values from both list 1 and list2.

regards.

2026-06-05 12-38-17
Eduardo Jauch

Hello @Bharat koshti 

It is always easier if you show the full code. For example, we don't know what are you really doing in the Assign node, or how are you appending the data to var1 before the looping, or how are your structures defined.

knowing this make it easier for us to understand what are you doing so we can help.

Please, if you can, provides us with your module/application, or if you can't (company police), add images that show the information I mentioned (full code, structures involved, assigns, properties of actions you are calling, etc).

Cheers

2023-12-11 06-11-39
Mohammad Shad

Hi @Bharat ,

I have implemented the required solution for merging the two API response lists into a single structure as described.

I’m attaching the .oml file for your reference. You can import/open it in OutSystems to review the implementation and the approach used for combining the lists and handling the respective fields.

Hope this helps!

MergingList_.oml
UserImage.jpg
Niteesh yadav

Hello Bharat, what you are doing is right. Just make sure of the following:

  1. If var1 is a new variable, first append all the values of the IDs into a list by using listAppendAll, and then loop through that list.

  2. While looping, use the same filter you are currently using. Basically, it should filter the second API data based on the IDs. When it finds a record with the same ID in the second API variable, assign the status1 and status2 values. Make sure you assign these values to the same list/record that we are looping through.

  3. To make sure the values are being added correctly, use an if condition: if the status is empty, add "-" for testing purposes.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.