Hi all,
we have read range activity with varDataTable = dtInput and assing with linq query.
In attached the file input
File input.xlsx (8.9 KB)
Below the query used
dtFinal1 = dtInput.AsEnumerable().Where(Function(row) Not dtFinal1.AsEnumerable().
Select(Function(r) r.Field(Of String)(“Concat”)).Any(Function(x) x = row.Field(Of String)(“Concat”))).
CopyToDataTable()
when we execute this workflow we have this issue
In attached the workflow:
test.zip (2.7 KB)
Could you support us?
Thanks in advanced
S.
lakshman
(Ganta lakshman)
April 21, 2022, 3:58pm
2
@salvatore.quimi
May I know what you trying to do with Linq query here. If possible can you please share some sample input and output data.
postwick
(Paul Ostwick)
April 21, 2022, 3:59pm
3
The error message is self explanatory. You have a null value. Have you run it in Debug so when the error occurs you can look at the values?
hi @postwick ,
I have shared the workflow to verify by yourself. Anycase I have runned in debug but the values is not empty.
Could you support?
Thanks
postwick
(Paul Ostwick)
April 21, 2022, 5:13pm
5
I’m talking about the value returned by the LINQ query. If it returns no rows…
Yoichi
(Yoichi)
April 21, 2022, 11:23pm
6
Hi,
Your expression in the project contains dtFinal in right side as the following. It causes the exception.
Regards,
Hi @Yoichi
what do you mean “Your expression in the project contains dtFinal in right side” ?
I see the same value dtFinal1 in left side and in right side:
Could you support?
Thanks
Hello @salvatore.quimi ,
Please change the linq like this:
dtInput.AsEnumerable().Where(Function(row) Not dtInput.AsEnumerable().
Select(Function(r) r.Field(Of String)(“Concat”)).Any(Function(x) x = row.Field(Of String)(“Concat”))).
CopyToDataTable()
As @Yoichi explained, you had DtFinal in the right side which caused the exception.
Thanks!
Athira
dtFinal1 is null because it was never initialized. So when UiPath is trying to execute dtFinal1.AsEnumerable() in the LINQ statement, it is executing null.AsEnumerable(), which simply doesn’t work.
Test to initialize dtFinal1 with e.g. dtInput.Clone (it will copy the data table structure but not the rows).
Hi @athira.somasekharan
thanks for your suggestion, I have changed the linq like you suggested, but now I have this issue:
“Assing: The source contains no DataRows” → but as my screen dtInput contains data
Could you support?
Thanks in advanced!!!
Hello @salvatore.quimi ,
Then @ptrobot 's solution makes more sense. Please try it out!
Also, can you plean explain what you are trying to achieve here?
Thanks!
Athira
Hi @athira.somasekharan and @ptrobot
I also tried dtFinal1 = dtInput.copy and dtInput.clone as below:
but I always have the same error,
I used this expression in a process that has been working for months, but since yesterday I have this problem
Any suggestion?
Did you revert the change after testing @athira.somasekharan solution?
Just tested on my computer and it’s working without error:
Hi @ptrobot
now it works, thanks a lot!!!
Best Regards