How To Get Data From Filter Array Of Strings

Hi Guys,

I would want to filter data from array of list like example below , how can I do that on Uipath thanks for answers.


I would want to filter only CN values in this array of list. I try some assign commands but not worked.

Thanks for help

some details are not clear. give a try on

arrYourVar.Where(Function (x) x.StartsWith("CN=")).toArray

What is “x” in function ? :slight_smile:

its just for assigning you can use whatever you need @burakavuncu


Hi ,

It shows like that, how can ı get only “CN” values this. I need only get values from CN parameter in this array of list.


Hi @burakavuncu ,

We would like to know more about the type of the Data provided, You did mention it is an Array of List. If that is the case, Could you Show us the Variable Panel to which variable this value is Stored ?

Or Let us know if the Data is in the Text/String format.


I get array of list from Active Directory and after that I assing this values coming from AD to string.join list.

Okay so this is one list of string right? or this list of<System.String(array)>?


It’s system.string

just dump the variable within the immediate panel during a debug and share it with us. This would be fast way to share with us essential details

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

It’s like that;

ok, thanks
give a try on adopted statement

When splits are needed

arrYourVar.SelectMany(Function (x) x.Split(","c)).Where(Function (x) x.StartsWith("CN=")).toArray

when not splits are needed:

arrYourVar.Where(Function (x) x.StartsWith("CN=")).toArray

you can prototype it also directly within the immediate panel

When I try it , it returns like that;

I need to filter only CN values.

yes because you did not use within immediate panel.

Adding a toString to a String array will result on this.

Immediate panel is faster for checking otherwise you need to join the values:

String.Join("|",arrYourVar.SelectMany(Function (x) x.Split(","c)).Where(Function (x) x.StartsWith("CN=")).toArray )

Its worked dude.

Thanks so much^^

Ând last question how can I write each “CN” newline ? Is it possible ?


Instead of “|” in the expression use Environment.NewLine @burakavuncu

String.Join(Environment.NewLine,arrYourVar.SelectMany(Function (x) x.Split(","c)).Where(Function (x) x.StartsWith(“CN=”)).toArray )


1 Like

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