I hope, someone can help me with this topic. I have tried some solutions from similar topics but nothing worked for me.
I am trying to filter a data table, which contains one column with dates, based on the input from a user.
Example: user needs to provide two dates (start and end), and the final table output, should contain only rows between these two dates.
I already have converted each row of the datatable column using “Convert.ToDateTime(row(1).ToString).ToString(“dd.MM.yyyy”)”.
Unfortunately I cannot share the xaml of this project due to sensitive data.
@Rokko Use Filter Data Table or use Select Method to Filter the column , but make sure you have the Column Data Type as Date time.
Or As you Are Already using a ForEach to Convert the Object To DateTime Then Compare the Date Value against the The Conditions you have then if the condition matches, then add that row to a new data table.
I used the Filter Data table activity, however it is not working. I still get all the results from the original input.
Here you can take a look on the part of the sequence I’m using to prepare my DataTable:
Well, in the “For each” activity I am converting data from my excel, using assign like this: row(1) = Convert.ToDateTime(row(1).ToString).
The two variables are for sure in the same format (Datetime).
That is why it is a bit confusing for me.
Please try to display the value in the for each row as row(“date column heading”).tostring and the value you are getting from the user, and check if they are in the same format including the slashes or the colons you have
@Luis261980, I want to filter out from my DT all rows, which are not inside the range provided by the user.
If the range in this example is start=09/10/2019 and end=09/30/2019, the DT should have only rows in which date is between these two dates.
@HareeshMR, they should be in the same format. I prepared the new .xaml file when I cut out all sensitive parts of my process. Please, take a look and tell me if something is wrong.
I attached also a sample of my .xls file.TEST.zip (10.8 KB)