16
Views
1
Comments
Adding two lists without duplicates.
Application Type
Mobile

Hi,

So I have this scenario: 

I have two lists (list1 and list2). Which has two columns (Type and value).

list 1(Type, Value)                           List 2(Type, Value)

A -> 1                                                 B->2

B-> 4                                                  C-> 4

C-> 3                                                   A-> 6

                                                            D-> 7


I want a result in a single list which has.

A-> 7

B-> 6

C-> 7

D-> 7


How can I achieve it?


Thanks in advance,

Abhishek

UserImage.jpg
vikas sharma
Champion

Hi,

I think for this you need to write logic yourself. It may be some thing like below :

Step 1 : Iterate second list.

Step 2 : Here will be logic like we will compare each element of Second List. Is type already there in First List then First[current].value = value+Second[Current].

If type is not there already in First list, then just simply ListAppend into first list. Value will be current of second list.

regards

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