I think you need begin delete rows from end Try this:
Code
countRows = Object.Goods.Count();
For i = 1 to countRows Do
Row = Object.Goods[countRows - i];
If Row.Item.Type = Enums.ItemTypes.Service Then
Object.Goods.Delete(Row.LineNumber - 1);
EndIf;
EndDo;
The problem occur when rows ,that is needed to delete, stand in line one by one, because quantity of tabular section decreases on 1 but operator "For Each" continues to work with old indexes and skips row that is needed to delete but it's behind current iteration. You can overcome this problem like this:
Code
DeleteRow = True;
While DeleteRow Do
For Each Row In Object.Goods Do
If Row.Item.Type = Enums.ItemTypes.Service Then
Object.Goods.Delete(Row.LineNumber - 1);
DeleteRow = True;
Continue;
Else
DeleteRow = False;
EndIf;
EndDo;
EndDo;
First of all, you should check if such an item exist. Then loop from the end to begining.
Code
a=Catalogs.Workers.FindByDescription("kamil namli").GetObject();
If Not a=Undefined Then
RowCount = a.workersTable.Count();
For i=1 to RowCount do
a.workersTable.Delete(RowCount-i);
EndDo;
a.Write();
EndIf;
And after all, if you want to delete all rows you should use Clear() method.
Code
a=Catalogs.Workers.FindByDescription("kamil namli").GetObject();
If Not a=Undefined Then
a.workersTable.Clear();
a.Write();
EndIf;
Hi! You have to create an array, fill it with rows to be deleted. Then, in a loop around the array and calls the tables of Delete, as a parameter to pass an array element.
DeleteRows = New Array;
For Each Row In Object.Goods Do
If Row.Item.Type = Enums.ItemTypes.Service Then
DeleteRows.Add(Row);
EndIf;
EndDo;
For Each DelRow In DeleteRows Do
Object.Goods.Delete(DelRow);
EndDo;