Hi Team,
I have a datatable containing,
Invoice number, starting index, ending
abc,2,2
zyz,3,6
So, i want to delete the rows from starting index to ending index. How am i able to do it?
Hi Team,
I have a datatable containing,
Invoice number, starting index, ending
abc,2,2
zyz,3,6
So, i want to delete the rows from starting index to ending index. How am i able to do it?
Use Remove Data Row activity to remove rows
If you want to delete the columns use Remove Data Column activity
or use
I hope it helps!!
Can you breifly explain your query for better understanding
Read Range activity:
Input: Path to your Excel or CSV file
Output: dtInput (DataTable variable)
For Each Row activity:
TypeArgument: DataRow
DataTable: dtInput
Body:
If activity:
Condition: rowIndex >= row.Field(Of Integer)(“Starting index”) AndAlso rowIndex <= row.Field(Of Integer)(“Ending index”)
Then:
Remove Data Row activity:
DataTable: dtInput
DataRow: row
Use remove data column activity to delete the starting index and ending index columns.
Or else:
use delete range activity to delete the particular range.
If you got the solution for your issue. Please mark it as solution to close the thread and others also helped.
Regards,
here 1-10 you have shown, UiPath is taking it as 9, but i want to delete all rows from 1-10. using linq(recommended)
To delete rows between a index you can use the below linq:-
In Assign Activity:- dtOutput.Select().Skip(startIndex).Take(endIndex - startIndex + 1).ToArray()
In InvokeCode:-
For Each rowToDelete As DataRow In rowsToDelete
dataTable.Rows.Remove(rowToDelete)
Next
Note:- startIndex and endIndex is a variable that can be initialized based on your need
If you want to delete all the rows in the datatable. You can use the Clear datatable activity.
It clear all the rows data in the datatable, the columns will be remain and we can use the datatable for further use.
Hope it helps!!
listDt and rowToDelete must be same, right?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.