How to split a number of Array to number of array list with customize size?

Hi guys, 

I am facing a trouble that I have a list of numbers:

List of Number (Integer) - 6 items

    • 10189(Number (Integer))
      • 9386(Number (Integer))
        • 9650(Number (Integer))
          • 10278(Number (Integer))
            • 16467(Number (Integer))
              • 9813(Number (Integer))

              I need to split them to three array, and each array has 2 number values.

              so it still going to be a list, which has 3 array, and each array has 2 values.

              Can anyone can help me for this?

                Discussion posts and replies are publicly visible

              Parents
              • Try this example, where local!array is your initial list of integers, and local!childArrayLength is your desired size for the nested arrays:

                a!localVariables(
                  local!array: {10,20,30,40,50,60,70,80,90,100},
                  local!childArrayLength: 2,
                  local!finalSize: ceiling(count(local!array)/local!childArrayLength),
                  
                  a!forEach(
                    items: 1+enumerate(local!finalSize),
                    expression: {
                      reject(
                        fn!isnull,
                        index(
                          local!array,
                          if(fv!isFirst,fv!item,fv!item*local!childArrayLength-local!childArrayLength+1)+enumerate(local!childArrayLength),
                          null
                        )
                      )
                    }
                  )
                )

              Reply
              • Try this example, where local!array is your initial list of integers, and local!childArrayLength is your desired size for the nested arrays:

                a!localVariables(
                  local!array: {10,20,30,40,50,60,70,80,90,100},
                  local!childArrayLength: 2,
                  local!finalSize: ceiling(count(local!array)/local!childArrayLength),
                  
                  a!forEach(
                    items: 1+enumerate(local!finalSize),
                    expression: {
                      reject(
                        fn!isnull,
                        index(
                          local!array,
                          if(fv!isFirst,fv!item,fv!item*local!childArrayLength-local!childArrayLength+1)+enumerate(local!childArrayLength),
                          null
                        )
                      )
                    }
                  )
                )

              Children