Hi everyone!
I’m facing an issue with a process.
After defining the oldest date in a Excel file I need to copy the amount referent to that row.
So the oldest date in the example is 8/18/2023 and the oprocess should assing the value in the column “Amount” to a variable.
I’m trying to use the following formula:
dt_InvoicesTable.AsEnumerable().Where(Function(r) r(“Due Date”).ToString=str_LastDate)(0)(“Amount”).ToString
str_LastDate is the variable which defines teh oldest row in the file.
The only way I’ve found so far to make it work is by using .Contains
However I’d prefer to have the exactly match.
I could also use For Each Row activity but this could make the process quite slow so it wouldn’t be the first option.
Thank you in advance for the help.
1 Like
Srini84
(Srinivas Kadamati)
August 28, 2023, 1:27pm
2
Hi @roberto.piccolli
Check is the str_LastDate and the excel data date are in same format or not, If not try to make that into same format and then compare
Hope this may help you
Thanks,
Srini
Hi @Srini84
The format is the same (M/dd/yyyy).
mkankatala
(Mahesh Kankatala)
August 28, 2023, 6:12pm
4
Hi @roberto.piccolli
With out using any linq queries, first usually print the Due Date in a log message to check which format it was showing. I think it will show like 08/18/2023 00:00:00 (dd/MM/yyyy hh:mm:ss).
If it will print in the above format the linq query will fail.
In this case we have to make the Str_LastDate variable in same format then it will compare it properly your linq query will work.
Hope it helps!!
Hi @mkankatala
Thank you for the response. The problem was indeed with the date format.
Even though it didn’t have the time in Excel it was being printed in Studio.
By adding the time Linq formula works just fine.
Thank you!
1 Like
mkankatala
(Mahesh Kankatala)
August 29, 2023, 1:34pm
6
Thank you @roberto.piccolli
Happy Automation!!
system
(system)
Closed
September 1, 2023, 1:35pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.