Summing two list of numbers to output a single list of number

I have two lists:

List A:
10, 20, 30, 40

List B:
5, 10, 15, 20

How can I obtain a list of number which is the list of sum of each variables between two list?
Desired output:
15, 30, 45, 60

Many thanks

Hi there, @phetxdphet… one way to do what you described (assuming you would want to save the summed list) is to use a backend workflow that has parameters for the first list, the second list, and a number that will be used to refer to an item number in the lists (let’s call this parameter item number).

When you call the backend workflow, you would pass both lists as parameters, and you would pass the item number parameter as 1. The first action in the backend workflow would add to a new list list a's:item #item number + list b's:item #item number. The second action in the workflow would call the backend workflow again, and the item number parameter would be item number + 1. The second action would also have an Only when condition of item number <= list a's:count so the workflow will stop running after it has iterated through the entire list.

Anyway, without knowing more about your exact use case, that’s what comes to mind, and I hope it helps.

Best…
Mike

6 Likes

And this is how one masterfully explains how a recursive workflow works! Awesome stuff @mikeloc !

1 Like

What an absolutely detailed response and thanks so much for a solution that stays within bubble’s capabilities. Although I resulted to using js this would work perfectly for anyone that has the same use case.

Thanks @mikeloc for the thorough help!

1 Like