Dear All,
I have 2 SP list (List 1 and List 2)
- List 1 is detail item with Name + Quantity
I want to make flow that can copy sum Data of each items from list 1 to list 2
List 1
List 2
Thank for your detail explanation and support. I really appreciate your help.
One again, Thank you very much. !!! and Happy New Year.!!!!
Hi @hainguyen
Please follow This as per your requirement.
1. Use Get Items Action and get all the items from list 1
2. Use One Select Action and Select Only Name From get Items Action.
3. Use one Compose Action and perform union on body which return by select Action.
union(body('Select'),body('Select'))
4. Then use one Apply to each Action and provide value which return by union.
5. In apply to each Action use one filter Action and filter list 1 according to Name (which is current value of apply to each).
items('Apply_to_each')?['Name']
6. Then use one compose Action rename to JSON and provide expression.
{
"root": {
"Numbers": @{body('Filter_array')}
}
}
7. Then Use one another compose Action rename to SUM and provide expression.
xpath(xml(outputs('JSON')), 'sum(/root/Numbers/SL)')
Note: In expression SL is a column name of List 1
8. Use Get item action and list items from List 2 according to filter query.
Note: In filter query name also enclose with single quotes.
items('Apply_to_each')?['Name']
9. Then Use one condition Action.
empty(outputs('Get_items_From_List_2')?['body/value'])
10. create or update list 2 according to condition output.
In Update item Action
Id:
outputs('Get_items_From_List_2')?['body/value']?[0]?['ID']
Title:
outputs('Get_items_From_List_2')?['body/value']?[0]?['Title']
Name:
outputs('Get_items_From_List_2')?['body/value']?[0]?['Name']
Total:
Complete Flow
SPL List1:
SPL List2:
Hope it helps!
Hi @Amit_Sharma ,
I follow your instruction, however, what i need i Copy and update Sum data in List 2.
your flow it's only copy. Could you please help me to get update if list 1 add more items.
Hi @hainguyen
When I Post My Reply, I don't Know How All Thing Collide with each other?
Please Wait I will recreate For You
Hi @hainguyen
I have created sample for you
1. Get All Item from First List
2.
union(body('Select'),body('Select'))
3.
Use One Filter Array Action
items('Apply_to_each')?['Name']Name is Column name here
4. Use one compose Action rename to JSON and put value.
5. Use another compose action Rename to Sum and put Expression.
xpath(xml(outputs('JSON')), 'sum(/root/Numbers/Quantity)')
Quantity Is column name in expression of first List
6. Use create item Action and pass value.
items('Apply_to_each')?['Name']
--------------------------------------------------------------------
If I have answered your question, please mark post as Solved.
If you like my response, please give it a Thumbs Up.
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional