But @prasath17
I was also thinking same, but when i saw one post regarding this some months back where dates are compared by string, it is working fine as well
In the above code, you are checking the Grn Date is equals to Now.dateā¦i believe none of the values in the sheet has the 08/20 date so it is returning the count to 0.
CDate(row(āGrn Dateā)).Date > now.Date)
Note: CDate and Datetime.parse will work based on the local system settings, i.e. my local settings MM/dd/yyyy so if use cdate with dd/MM/yyyy format it will thrown an error.
You get it??
Suggestion: Before using LINQ please try the simple for each row and use write Line to print the date values and then based on that use If condition to check you are getting the right results. Once you successfully done this, you can apply the same logic in LINQ query. This way, you will learn how to play with datetime format and datetime parsing etc etcā¦
If I were you, my first priority would be to use the incoming data and ensure that I clean or transform the column which I am interested in and save as a new DataTable (TransformedTable).
This ensures that you have one uniform format of input data within UiPath, which does not affect your raw data in excel.
And as @prasath17 said take a sample of your transformed table and use simple for each and DataTable activities. It will not perform well for over 5000 rows when compared to linq. You can do this by slicing the Transformed DataTable
SampleTransformedTable= RawInputTable.Clone ā This extracts Header Type and Headers names and creates a DataTable named SampleTransformedTable
SampleTransformedTable=TransformedTable.AsEnumerable().Take(50).CopyToDataTable() ā This takes top 50 rows from the TransformedTable and copies them to SampleTransformedTable
Yes the idea was to use the same column names as RawInputTable, if the TransformedTable has additional columns after transformation then it is best to use TransformedTable.Clone(). So both should work fine if the column names and types are different.
Good spotting: TransformedTable.Clone() would be the safer choice.