Forum Discussion
Manually moving rows in a table
- Anonymous6 years ago
waiting foe MS to develop what you nedde, give a try to this function:
let moveRow = (tab,row, posToMove)=> let Pos=Table.PositionOf(tab,row), fromPos=Table.RemoveMatchingRows(tab,{row}), toPos=Table.InsertRows(fromPos,Pos+posToMove,{row}) in toPos in moveRowif you have a table like this and want to move row [col1=22,col2=bb] two position down
you can call the function and get this
if you want to move row [col1=33,col2=cc] two positio up (use a negative relative position)
it is possible using this scheme to add also the management of moving whatever row from pos Pi to position Pf
waiting foe MS to develop what you nedde, give a try to this function:
let
moveRow = (tab,row, posToMove)=>
let
Pos=Table.PositionOf(tab,row),
fromPos=Table.RemoveMatchingRows(tab,{row}),
toPos=Table.InsertRows(fromPos,Pos+posToMove,{row})
in
toPos
in
moveRow
if you have a table like this and want to move row [col1=22,col2=bb] two position down
you can call the function and get this
if you want to move row [col1=33,col2=cc] two positio up (use a negative relative position)
it is possible using this scheme to add also the management of moving whatever row from pos Pi to position Pf
where do i put the code that defines the 'MoveRow' function? Im wanting to put the code on an appended query