Hi @Pragadeshgp , sure, basically the trick to move the list into 2 rows is to use the Column to Grid node. This node allows you to specify the width of the grid, so you can dynamically set that width based on the number of elements in the list.
For each row, the grid should have a minimum of 2 columns as width, and increments by 2 columns to adjust to the size of the list.
For example, if you have:
2 elements - 2 columns in the grid
3 elements - 2 columns in the grid
6 elements - 4 columns in the grid
I use the formula of:
ceil(ceil(number_of_elements / 2)/4) * 4 to determine the width of the grid. The grid will add the second row automatically.
Here’s 1 way to do this:
1-3 are your use cases. I added 2 more use cases to see the behaviours for various list size:
Use case #4 has 6 elements.
Use case #5 has 14 elements.
As you can see, it split the grouping into blocks of 2x2.
Note about the formula: The reason why I’m doing
ceil(... /4) * 4 is to prioritize horizontally if you have 6, 10, 14, 18, etc elements, basically the number of elements that’s in between multiples of 4.
For example, if we look at Use Case #4, which has 6 elements, if I do not add this formula and stick with
ceil(number_of_elements / 2) only, the output will be:
| 2 | A | B | C | |
| 2 | D | E | F | |
With the added formula, I get:
| 2 | A | B | C | D |
| 2 | E | F | | |
Here’s the workflow: