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.
I made this topic public because the answer might also help others
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
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.
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.
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
There are examples within the VB.Net
Syntax available as well
LinqSample.zip (12.1 KB)
I created a sample with LINQ that enumerate files 3 different ways.
- ascending file names
- descending file names
- ascending file size
Hope this helps.
Please make sure to edit the variable that stores the directory to enumerate before running
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
cheers
Happy learning
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? )
EnumerableRowCollection
{ DataRow
{
HasErrors=false,
ItemArray=object[4]
{ “First”, “F2”, 4, 11 }, RowError=“”, RowState=Added, Table=[ ] }
}
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
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.