Hi Friends,
I’m tring to delete rows under a specefic row (the row indicate the day -1): here is the output of the datatabele there is one column:
Column-0
XXXX
01/06/2021
XXXX
XXX
XXXX
04/06/2021
XXXXX
XXXXX
07/06/2021
XXXXX
15/06/2021
YYYY
AAAA
ZZZZZ
ZZZZE
TTTTT
E1166O100716
AAAA
Reformulate your question and give example of expected result.
Cheers
Hello ,
i had extracted a datatable wich contain 1 row, i want to keep only the one starting from (for exemple ): 15/06/2021
I can see one column in your original post.
What exactly do you have: Datatable with one row OR Datatable with one column?
Cheers
datatable with one column
Okay. And what result do you want to get?
kep inly the rows under the specefic one (which include the yesterday date)
So this?
yes, i choose these values as an example
give a try on:
find the postion for the date now -1 day:
pos =
yourDataTableVar.asEnumerable.toList.FindIndex(Function (x) x(0).toString.Trim.Equals(now.AddDays(-1).toString("dd/MM/yyyy")))
extract needed rows:
dtDFiltered =
yourDataTableVar.AsEnumerable.Take(pos).CopyToDataTable
Should be rather “skip”, right?
dtDFiltered =
yourDataTableVar.AsEnumerable.Skip(pos+1).CopyToDataTable
Cheers
I was interpretating the delet that rows under the date are not of interest. Thats why Take was selected. Did I missinterpretate the reqs?