Hi @virakones :
Do you want to group the records in the table in order?
If so,I've made a test for your reference:
1\I assume there is a table
ClearCollect(
TheTable,
{Memo:"Memo 1",'Line Id':1},
{Product:"Product1",Description:"Description",'Line Id':2},
{Product:"Product2",Description:"Description",'Line Id':3},
{Product:"Product3",Description:"Description",'Line Id':4},
{Memo:"Memo 2",'Line Id':5},
{Product:"Product4",Description:"Description",'Line Id':6},
{Product:"Product5",Description:"Description",'Line Id':7},
{Memo:"Memo 3",'Line Id':8}
)
2\Add a button and set it's OnSelect property to:
ClearCollect(
Thetargettable,
With(
{
ParentTable: ShowColumns(
Filter(
TheTable,
!IsBlank(Memo)
),
"Memo",
"Line Id"
)
},
ForAll(
Sequence(CountRows(ParentTable)),
{
Memo: Last(
FirstN(
ParentTable,
Value
)
).Memo,
'Line Id': Last(
FirstN(
ParentTable,
Value
)
).'Line Id',
'Sub-Collection(Product)': Filter(
TheTable,
'Line Id' < Last(
FirstN(
ParentTable,
Value + 1
)
).'Line Id' && 'Line Id' > Last(
FirstN(
ParentTable,
Value
)
).'Line Id'
)
}
)
)
)
The Result:

Best Regards,
Bof