LINQ learning materials

Hi @loginerror
I want to learn more about Linq how we can implement it in Uipath. If you have any documentation or any study material of it then please provide me.

1 Like

Hi @jitendra_123

I made this topic public because the answer might also help others :slight_smile:

LINQ expression is a big topic to cover at once. Some basic resources can already be found if you simply google for
linq
or maybe even
linq vb.net

In the context of UiPath, the easiest start is by looking at examples here on the Forum (by searching for linq on the forum)

I would start with simple expressions to achieve basic filtering and move on from there.

I hope other users can share their experience in the topic as well and some resources they used on the way :slight_smile:

4 Likes

Hi,

To know/learn about Linq you can refer the below links

But at times when I want to write some complex linq queries I have used Visual Studio and test the query there before implementing it in UiPath.

5 Likes

Hi @loginerror @sarathi125
Thank you for the reply but I will wait for some more users input as I need to know how exactly we can implement the syntax of LINQ queries in Uipath.

1 Like

Hey @jitendra_123

just go through this Url which he provide in his post

Cheers

1 Like

Hello,

I reffered https://www.tutorialsteacher.com/linq/linq-tutorials and felt its very good to learn from basics, you can also refere tutorials point, code project and stackoerflow for examples and scenarios.

Thanks,
Meg

3 Likes

There are examples within the VB.Net Syntax available as well

6 Likes

LinqSample.zip (12.1 KB)
I created a sample with LINQ that enumerate files 3 different ways.

  1. ascending file names
  2. descending file names
  3. ascending file size
    Hope this helps.
    Please make sure to edit the variable that stores the directory to enumerate before running
6 Likes

This is a good topic! I saw a lot of posts that needed this kind of information.I will bookmark it and once needed i will share it :smiley:

cheers :smiley:

Happy learning :smiley:

3 Likes

Hi @megharajky and all,

I learnt LINQ from TutorialsTeacher, but when iam trying to implement them in Uipath I am getting a weird error…not sure if my syntax is wrong because iam learning it through Uipath

I tried different validations using .equals, Is, = operator…but all gave the exception

Iam trying to execute:
dt.AsEnumerable.Where(function(s) s(“Screens”).ToString = in_ScreenName and s(“Field”).ToString = in_FieldName)

in_ScreenName - String Type and Value: “Screen1”
in_FieldName - String Type and value: “Field1”

result -
EnumerableRowCollection
{
!< ObjectDisposedException > …
}

Another Approach, I hardcoded the in_screenName and in_FieldName values like:
dt.AsEnumerable.Where(function(s) s(“Screens”).ToString = “Screen1” and s(“Field”).ToString = “Field1”)

result is - what I wanted (But why not through a variable in func? :man_shrugging:)
EnumerableRowCollection
{ DataRow
{
HasErrors=false,
ItemArray=object[4]
{ “First”, “F2”, 4, 11 }, RowError=“”, RowState=Added, Table=[ ] }
}

1 Like

Hello,

I tried the same and not getting any errors, please try the below code,

dt.AsEnumerable().Where( Function(s) s(“scfreens”).ToString=“Screen1” And s(“Feild”).ToString=“Feild1”).CopyToDataTable

image

1 Like

Hi @saiteja8

What is the syntax error? You could try updating the activity packages to the latest version, it might fix the issue.

Thank you for the sample file. Very useful.