Is this type of C# array possible in UiPath?

So I’m reposting this question here and deleted it from the previous category. Is it possible to build this type of array in UiPath? Thanks in advance!
arr

@Russygrl I don’t think it’s possible in the same way, But if you tell us what you want to Achieve using this , We can make a workaround for it :sweat_smile:

1 Like

Did we try with INVOKE CODE activity
@Russygrl

1 Like

hey there @supermanPunch and @Palaniyappan what i would like to do is to retrieve age > 12 and age < 20. I know uipath doesn’t support lambda functions so it wouldn’t look like the expression below, but i do know i can use Function(x). Thanks in advance guys!
cond

1 Like

@Russygrl
The codelines will Not Work due the Definition of the Student class ist Not defined with this isolated Code Fragment.

Am i right, the Sample comes from some linq Tutorial Pages?

Kindly Note. Lambda Expression in VB are available but are looking different. As you right mentioned within the function form

1 Like

Yes @ppr the code snippet comes from https://www.tutorialsteacher.com/linq/linq-query-syntax. So are you saying that there is no workaround for this type of problem? Thank you!

you can use data tables to create the object student…

@Russygrl

So are you saying that there is no workaround for this type of problem?

No, was just saying as long the class of Student is nowhere defined, registered, referenced… Student is unknown. Simple copy or paste will have the risk of throwing errors

But lets assume you are interested in LINQ on learning how to write Statement you will have options for more direct starting to do some practice (just lets avoid a XY Problem)

For simple equivalent you can practice with

  • a List Of Integer and writing a similar check
  • as mentioned above by bcorrea doing it on datatable (often for datatables we do use LINQ)
  • simulating a class definition with a Dictionary(Of String, Object)

Fore some reasons my UiPath Installation is Out of Service. But lets stay in touch and I can help you for starting or passing a xaml with some samples to you

1 Like

kool @ppr appreciate you and everyone helping out, thanks all!!! Much Love

@Russygrl
Find demo XAML showcasing:

  • where filtering on DataTable Base
  • where filtering on List(Of Dictionary(Of String, Object)) Base

I suggest to set some breakpoint on the comments and debug the xaml for inspecting the different results.
With a deeper look on the different LINQ statements you will get an initial understanding on how it is written for VB.Net

Russygrl.xaml (9.0 KB)

1 Like

It’s not possible yet to define custom types in Studio, but for simple data types there is also the possibility to use tuples in data processing jobs. So instead of a custom Student type you can use
Tuple(Of Int32, String, Int32) where first integer maps to Id, the second string maps to Name and the third integer maps to Age.

So you can define a list of students using an Invoke Code activity:

studentList = New List(Of Tuple(Of Int32, String, Int32)) From {
    Tuple.Create(1, "John", 18),
	Tuple.Create(2, "Steve", 21),
	Tuple.Create(3, "Bill", 25),
	Tuple.Create(4, "Ram", 20),
	Tuple.Create(5, "Ron", 31),
	Tuple.Create(6, "Chris", 17),
	Tuple.Create(7, "Rob", 19)
}

Using another Invoke Code activity you can filter the list using:

teenagerStudents = (From s In studentList _
                    Where s.Item3 > 12 And s.Item3 < 20 _
                    Select s).ToList()

Here is a demo: Main.xaml (5.5 KB)

2 Likes

@ppr thanks for not forgetting!!! I appreciate your help and i will take a look at your code!
Once again thanx a million!

@Gino thank you for this solutions, there are so many things to learn. it’s overwhelming, sometimes i dont know where to start! But i came across the LINQ article, I thought it was so interesting and i wanted to see if i could duplicate it in uipath. i will take a look at you the code you provided, really appreciate it!!