Hi everyone,
I have an array and data table consists of dates. I want to check if the dates that are in the data table match with the array. Then, it prints “arrayDate=Tabledate” therefore, it matches. Else, it prints the dates do not match
Hi everyone,
I have an array and data table consists of dates. I want to check if the dates that are in the data table match with the array. Then, it prints “arrayDate=Tabledate” therefore, it matches. Else, it prints the dates do not match
getting the datatable column value into an array we can do
arrDataDates =
YourDataTableVar.AsEnumerable.Select(Function (x) x(YourColNameOrIndex).toString.Trim).toArray
so with the in your other topic mentioned Set Operation options we can check for the present/absent values
when implementing your case within a for each row we can do:
For each row in datatable
I am using Dt.AsEnumerable.Select(Function (x) x(Dt.Rows(“Date”).toString.Trim).toArray). However, I am getting implicit conversions from string to integer error
Hey @RPA_Path
Kindly try the below,
Foreach Row in DataTable
If dateArr.Contains(Row("Date").ToString.Trim)
Print "Match"
Else
Print "No Match"
Hope this helps.
Thanks
#nK
Above expression is wrong. It should be like below.
Dt.AsEnumerable.Select(Function (x) x("Date").toString.Trim).toArray
Here you are trying to loop one by one item from DataTable and checking against the array. If the value match then it will go to the Then part else Else part.
I see where it went wrong, thank you.
One more question, is it possible to log the dates that were matched instead of the word “match”?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.