How to add multiple rows with possible combinations?

Hi,

A ‘list_name’ column of ‘LIST’ table has 4 rows.
list_name
A
B
C
D

I’d like to add rows to the ‘target_comnination’ column of ‘TARGET’ table.
target_comnination
AB
AC
AD
BC
BD
CD

Is it possible to add rows like above by “call a webhook”?

Thank you.

It should be. Is the original row amount always 4 or can it be something else?

1 Like

The count of the list_name row is flexible every month and I am going to add rows to the TARGET table every month.

What’s the max number of rows for the process?

1 Like

There is no limit of the count of the list_name row, but usually about from 10 to 30.

So.. it would need 435 new rows with 30 rows, right?

1 Like

30c2=435
Right.

When a group has 30 companies, there can be 435 internal transactions.

One solution is to build this with an additional table that has three columns.. ID, Number1 from 1..29 and Number2 column from 2..30. They would be something like..
1,1,2
2,1,3
3,1,4

29,1,30
30,2,3
31,2,4

435,29,30

The idea of this table is A) something to loop and B) to read correct rows with the INDEX().

The loop will be..
<<START:ORDERBY(SELECT(AdditionalTable[ID],[ID]<=[_THISROW].[SourceAmount]),[ID],FALSE)>>

The new double-digit value or what ever that is, will be generated to your target table with something like..
<<INDEX(SORT(SourceTable[Column],FALSE),[Number1])&
INDEX(SORT(SourceTable[Column],FALSE),[Number1])>>

I didn’t test this but it should work :slightly_smiling_face:

2 Likes

I appreciate your idea. I will try it.

1 Like

Though you need to adjust the row order in this additional table. Meaning you can’t have e.g. 1,2.. 1,3.. 1,4 to 1,29 in the beginning. You need to sort them in the order they grow.

2 Likes

I couldn’t understand this.
can’t have e.g. 1,2.. 1,3.. 1,4 to 1,29 in the beginning

Is it not same with this?
1,1,2
2,1,3
3,1,4

29,1,30
30,2,3
31,2,4

435,29,30

※ Another Question
Should I fill the values to the ‘AdditionalTable’ by hand or by bot?

Interesting enough and easier to explain with a sample app :slightly_smiling_face: Let me create it quickly.

1 Like

. :heart_eyes: :heart_eyes: :heart_eyes: .

https://appsheet.com/portfolio/77079 and MathGenerator.

The webhook is triggered when a new row is added to the Source table

3 Likes

Good morning.

What a simple and fantastic logic!

Thank you again.

1 Like

You’re welcome!

1 Like