Linq query Exception

Hi,

I am using the below query to get unmatched records based on a column. When i use the query getting the below error. Any assistance on where i am doing wrong

  • Assign activity in the value field

dt1.AsEnumerable().Where(Function(row) Not dt2.AsEnumerable().Any(Function(x) x(“Employee Code”).ToString.trim=row(“Employee code”).ToString.trim)).Copytodatatable

Error

@Sasikanth

I guess you copypasted the formula from somewhere…

Please replace the incerted comma woth a inverted comma again in code

Cheers

Hi @Anil_G

I did try the same already getting the same error . PFB

Hi @Sasikanth ,

Could you let us know if you are using c# as the language in the workflow or is it vb.net ?

Hi @supermanPunch ,

I am sure i am using VB only in the workflow as language because i remember selecting VB option. Not sure how to check now and confirm you with screenshot

@Sasikanth
Use below one
dt1.AsEnumerable().Where(Function(row) Not dt2.AsEnumerable().Any(Function(x) x("Employee Code").ToString.trim=row("Employee code").ToString.trim)).Copytodatatable()

remove double quotes and put again

or

dt1.AsEnumerable().Where(FunctionCType(Not dt2.AsEnumerable().Any(FunctionCType(x("Employee Code").ToString.trim=row("Employee code").ToString.trim, x)), row)).Copytodatatable()

Regards,
Arivu

@arivu96

tried the same…getting the same mentioned error as the one in the screenshot

Not sure where i am doing wrong

Hi @Sasikanth ,

try below one

(from row in dt1.Select where (from item in dt2.Select where item("Employee Code").ToString.Equals(row("Employee Code").ToString) select item).ToList.Count>1 select row).ToList.CopyToDataTable()

Regards,
Arivu

1 Like

You can check in the bottom right corner of studio, it should say the selected language and whether you used Windows, Windows-legacy or Cross Platfrom. See here:
image

Hi @iamNairda ,

In our organisation they are using v.2019.10.1, so i don’t see that in bottom right corner of studio

@arivu96 - even for this query its throwing the same error

Hi @Sasikanth, i tried from my end working fine what error are you getting can you share the error screenshot and error message.

Regards,
Arivu

You should see it in the project.xaml file then, just open it with notepad instead of Studio and search for VisualBasic, if it’s in there it’s most certain a VB project.

When you do this also verify that you find:

  <x:String>System.Linq</x:String>

Sometimes it also helped me on older Studio Version to Import LINQ into project through Import Panel (next to Variable/Arguments)

show us more from the surrounding modellings and the configured variables (variable panel). When for each activities are in use then also check the correct set typearguments

@ppr , @arivu96

I guess i found the issue.

I am trying to perform the query inside a nested for each row of type string.

That has to do something with my query. When i took the assign and tried it outside the nested for each, it is not giving any error

Any ideas on this???

@iamNairda

Thanks for the suggestion

the process is using VB language only

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.