Hi everyone :
I try to do this in data table :
For each row which contain a series of number, remove the row before it.
For the second row, if the row(“Column2”).toString.contain(“41087”) remove the first row (F0 B7 10).
Anyone help me please ?
Use if the row(“Column2”).toString.contain(“41087”) remove the first row (F0 B7 10).
then remove data row activity
How could i do that ? I explain my problem. I have different same bloc (example of excel input : Forum UiPath.xlsx (11.9 KB) )
I said “41087” for example but it will be “V1105” or else (look my excel input to understand). So it won’t always the first row.
Thank you for your reply.
@AshwinS2 I don’t see what part can help me…
hope these steps would helpyou resolve this
–hope we have the datatable named dt
–so now use a for each row loop and pass the variable dt as input
–inside the loop use a if condition like this
row(“Column2”).ToString.Contains(“41087”) and NOT dt.Rows.IndexOf(row).Equals(0)
If true it will go to THEN part where we can use a assign activity like this
dt.Rows(dt.Rows.IndexOf(row)-1)(“Column2”) = String.Empty
so this will assign null value to all the rows before to the row which has value as 41087
–followed by this for each row loop use a assign activity like this to get apart from those string.empty assigned rows
dt = dt.Select(“[Column2] <> String.Empty”).CopyToDatatable()
now the variable dt will be your output
You cant remove a row if you are inside a for each row activity, use activity Lookup Data Table to find the row, it will return the index found, use Remove Data Row to remove the row with index before that, but have to be careful to avoid errors when text is not found or it is found in first row, repeat until you dont find it anymore…