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
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
https://personal-udaksfpd.outsystemscloud.com/MergingList/MergingList?_ts=639162519840788448
you can use List Append_All and List_Sort
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.
ThanksTousif Khan
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.
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
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!
Hello Bharat, what you are doing is right. Just make sure of the following:
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.
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.
To make sure the values are being added correctly, use an if condition: if the status is empty, add "-" for testing purposes.