Hi,
I am trying to filter the data table based on the date to get the past 6 months’ record.
dt = dt.Select(“[Requested On] >= '”+date_before.ToString +“’ AND [Requested On] <= '”+date_now.ToString+“'”).CopyToDataTable().
and this throw me this error
I am still very new to uipath and can someone help me to get pass this error?
First, check your variables (dt, date_before and date_now) have value you expected.
Next, check there is record you want to get in the dt, because CopyToDataTable method return exception if there is no datarow item.
Finally, can you try the following?
dt = dt.Select(“[Requested On] >= #”+date_before.ToString(MM/dd/yyyy)+“# and [Requested On] <= #”+date_now.ToString(MM/dd/yyyy)+“#”).CopyToDataTable
or
dt=dt.AsEnumerable.Where(function(r) DateTime.Parse(r.toString)>=date_before and DateTime.Parse(r.toString)<=date_now).CopyToDataTable
both date_before and date_now are on DateTime variable
This is my xaml: testing.xaml time.xlsx
In my xaml I been using read csv however, file upload selection does not support csv file type hence, I change my file into xlsx file type so that I can upload a sample file here.
I had tried using the Filter Data Table, however, I am not manage to do so.