begin
while table1.Locate('parent;sort_ID',varArrayof([myID,0]),[]) do
begin
sort_ID:=sort_ID+1;
table1.Edit;
table1['sort_ID']:=sort_ID;
table1.Post ;
sortItem(table1['ID']);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sort_ID:=0;
sortItem(-1);
end;