Question on converting array into sub-arrays

Given an array
{"a","b","c","d","e","f", "g","h","i"}

Is there a way to convert it to an equal size sub-arrays as follows (say by specifying 3 in this case):
{{"a","b","c"}, {"d","e","f"}, {"g","h","i"}}

OriginalPostID-227719

OriginalPostID-227719

  Discussion posts and replies are publicly visible

Parents
  • Use the following code snippet. Just add a arbitrary array and define the split size. Comes in extremely handy if you have massive data to tackle and want to save memory.

    load(
    local!loops: tointeger(length(ri!Ids)/10)+1,
    local!indexIndicator: (enumerate(local!loops)+1)*10,

    a!forEach(
    local!indexIndicator,
    with(
    local!lowerIndex:fv!item-10,
    local!upperIndex:fv!item,
    a!forEach(ri!Ids,
    if(and(fv!index>local!lowerIndex,fv!index<=local!upperIndex),
    fv!item,
    {})
    )
    )
    )
    )
Reply
  • Use the following code snippet. Just add a arbitrary array and define the split size. Comes in extremely handy if you have massive data to tackle and want to save memory.

    load(
    local!loops: tointeger(length(ri!Ids)/10)+1,
    local!indexIndicator: (enumerate(local!loops)+1)*10,

    a!forEach(
    local!indexIndicator,
    with(
    local!lowerIndex:fv!item-10,
    local!upperIndex:fv!item,
    a!forEach(ri!Ids,
    if(and(fv!index>local!lowerIndex,fv!index<=local!upperIndex),
    fv!item,
    {})
    )
    )
    )
    )
Children
No Data