Hi Team,
I am getting error Cannot assign from type ‘System.Object’ to type ‘System.Data.DataTable’ in Assign activity I am using linq query to filter table and there is no error in the query.
When i created a new data table variable then the error was not showing and if i modified the query again the error message was the same.
Parvathy
(PS Parvathy)
February 23, 2024, 9:02am
2
Hi @Mohan_Reddy
Please delete the activity and reinitialize it again. It will solve the error. As we are getting these errors in the latest Studio updates.
Regards
@Mohan_Reddy
Try by remove the value in the assign and rewrite it.
Hope it helps!!
ppr
(Peter Preuss)
February 23, 2024, 9:11am
4
In such cases we help the compiler, by fine tuning the select
(From d in dtData.AsEnumerable
Where …
Select r = d ).CopyToDataTable
Thank for your suggestions @Parvathy & @pravallikapaluri ,
I have tried both the suggestions but the error persists.
Parvathy
(PS Parvathy)
February 23, 2024, 9:13am
6
Hi @Mohan_Reddy
May be the written query has some error. Try fixing that error.
Regards
Hi
Following is my Query, can you let me know where to modify it.
(
From r In dt_InputData
Where r(“Order Category”).ToString= “dineout”
Select r
).CopyToDataTable
Parvathy
(PS Parvathy)
February 23, 2024, 9:17am
8
Hi @Mohan_Reddy
Try this:
(
From r In dt_InputData
Where r("Order Category").ToString.Trim().Equals("dineout")
Select r
).CopyToDataTable()
Hope it helps!!
ppr
(Peter Preuss)
February 23, 2024, 9:17am
9
as mentioned within the bold parts:
(From d In dt_InputData.AsEnumerable
Where d("Order Category").ToString.Trim.Equals("dineout")
Select r = d).CopyToDataTable
never omit the AsEnumerable when writing LINQ statements dealing with datatables
Hi @ppr ,
I have copied and replaced it with a new code still it is showing an error.
ppr
(Peter Preuss)
February 23, 2024, 9:39am
12
As verified below it is compiling:
ensure the variable are created correctly, within the needed scope and not dupicated within different scopes.
We also do practice:
when a correct working statement is not accepted by compiler
delete the assign right side
save XAML
retype the same and correct statement
Due to some cache issues we encountered that corrections can sometimes hang
a correct working statement
ensure that it is correct and keep in mind
Mohan_Reddy
(Mohan Reddy)
February 23, 2024, 10:26am
13
Hi @ppr ,
I have tried all the ways (System restart & create a new process) but the error persists.
Today only my studio was updated to the 2024.2 version
I observed that in one of my colleagues systems, the query is working fine and i found that his studio version was 2023.13
ppr
(Peter Preuss)
February 23, 2024, 10:32am
14
can you share with us the used Package Versions?
we are much interested on the UiPath.System.Activities Package version. Feel free to downgrade it to a 23.10.X Level
Mohan_Reddy
(Mohan Reddy)
February 23, 2024, 12:18pm
15
Hi @ppr
UiPath.System.Activities package version: 23.10.2
ppr
(Peter Preuss)
February 23, 2024, 12:48pm
16
thanks for the feedback. We would assume that a 23.10.2 vs 23.10.5 will not make a change. Sucg LINQ we already used since 2018/2019
However, when the Correct statement is blamed by the compiler:
we can try by remodellings / cache forcings to get it accepted
When the issue comes from Studio Version 2024.2 then maybe some one else from the community could replicate at their end and let us know the result.
1 Like
system
(system)
Closed
March 1, 2024, 9:03am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.