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
              • 0
                Certified Lead Developer

                This code snippet is an example for splitting an array into sub-arrays (for now, embedded in a dictionary) where you can set the desired "chunk" size (the length of the resulting sub-lists) by changing the value of local!neListChunkSize.

                a!localVariables(
                  local!list: {11, 22, 33, 44, 55, 66},
                  
                  local!newListChunkSize: 2,
                  local!newListLength: tointeger(ceiling(length(local!list) / local!newListChunkSize)),
                  
                  a!forEach(
                    enumerate(local!newListLength),
                    {
                      chunk: fv!item,
                      subList: {
                        local!list[fv!index + fv!item],
                        local!list[fv!index + fv!item + 1]
                      }
                    }
                  )
                )

              Reply
              • 0
                Certified Lead Developer

                This code snippet is an example for splitting an array into sub-arrays (for now, embedded in a dictionary) where you can set the desired "chunk" size (the length of the resulting sub-lists) by changing the value of local!neListChunkSize.

                a!localVariables(
                  local!list: {11, 22, 33, 44, 55, 66},
                  
                  local!newListChunkSize: 2,
                  local!newListLength: tointeger(ceiling(length(local!list) / local!newListChunkSize)),
                  
                  a!forEach(
                    enumerate(local!newListLength),
                    {
                      chunk: fv!item,
                      subList: {
                        local!list[fv!index + fv!item],
                        local!list[fv!index + fv!item + 1]
                      }
                    }
                  )
                )

              Children
              No Data