Filter Date in Column According to Specific Assigned Date

Hi all,

Currently im developing a process of where i need to get specific row values that contained the date variable i assigned inside the column as in the picture.

DateVar1 = datetime.Now.AddDays(1)
DateVar2 = datetime.Now.AddDays(2)

I have check the format of the excel column values. But it does not have any specific format ie;General,date,Number. Nor of that fromat represent on the values contained in this specific column.

I have also tried to actually display all the values using message box. And seems like it is in string format.

And as for that, i have convert the date variable to string format (“MM/dd/yyyy”) as that is what shown in the message box.

But when i try to filter out that specific values there is no values capture except the headers of each column only.

Please help me, as im still new in Uipath and RPA. Attached are the screenshot of the table itself.

image

Hi, can you upload a screen shot of your workflow?
Also, are you sure that the variables are exactly the same type (datetime)?

@hairil.hashimie We would need to know how are you trying to do the Filter process


Sorry as it quite messy as im currently trying every method i found and none are working. But this is my date variable. And as for my best interest i would like to use filter wizard activity after the variable activity. and use that date variable as filter for that specific column. But somehow its not capturing anything from the column. Along with this i attached a screenshot of the values inside the column in excel file. Seems like it is in custom format.

image

Is there any solution for my problem?

currently i would like to have a values of current date +1 and +2 in the “SLOT_PLAN_DATE” column.
if in that specific row of the column contains the values, it will then stored and copy onto another excel sheet.
currently looking forward to find any solution that could be apply.

@hairil.hashimie The Filtering might not be having properly since it is a Date value and the value differs when we read the data from excel, Is it possible to provide the xaml file?

Hi,
Type of [SLOT_PLAN_DATE] in DataTable is DateTime, so date1 or date2 should also be of type DateTime:

for example, contains the date of one day later:

DateTime dateStart1 = DateTime.Now.AddDays(1)
DateTime dateEnd1 = DateTime.Now.AddDays(2)

//filter datatable
“SLOT_PLAN_DATE” > New DateTime(dateStart1 .Year, dateStart1 .Month, dateStart1 .Day)
And “SLOT_PLAN_DATE” < New DateTime(dateEnd1 .Year, dateEnd1 .Month, dateEnd1 .Day)

Thank you so much for your help. Appreciate your responses on this. But may i know hoe did you come up with that solution. Why cannt we just use equal or contains to that date variable assigned. Sorry for asking as i want to get a clear picture of what cause the problem i face. Hope you dont mind for some explanation.

Equal or Contains is generally used for String variables, Datetime doesn’t have this syntax

Thank you for your response. And how about the data type in the excel. How did you determined and filter it?

After you read excel range into the DataTable variable, you can use DataTable.Columns(“TargetColumnName”).GetType to get the type, through which you can decide which operator to use.

If you want to use the operators like contains, maybe you should change the type of the column in Excel to Text before reading range, or change the type of the target column in datatable to String after reading.

Thank you zack for your detail explanation. It do help me as im getting a lot of this things in current dev. Appreciate your help on this.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.