Make array of distinct Strings from a column in a data table that has values of type Integer and String

Hi guys,

I am using this following code in the assert activity to get an array of distinct Strings of values as output that were Integers in the input data table:
(Integers are being converted to Strings)

dt.AsEnumerable.Select(Function(row) row("WE").toString).Distinct.toArray

I want this also to work for columns in a data table that are of type String in the input dt already.
(Is hard for me but I think will be easy for the average expert here)
(Strings stay Strings)

What would be even nicer is if somebody could do it for a column that is mixed (ie has Integers and Strings) and that would be converted to an Array of Strings only.
(Strings and Integers should be converted to Strings only)
Example input and output in this picture:

Thanks a lot!

dt.AsEnumerable.Select(Function(row) row("WE").toString).Distinct.toArray

The statement is doing this already



As stated by @ppr the statement youa re using already does the same thing…if you have string and to make sure there are no extra spaces use a .Trim as well after .ToString


1 Like

No, it only seems to work for the values that are of type Integer. The values that are of type string are not in my output file. See my bot:
WE.xaml (18.9 KB)

and sample data:


Thanks for looking into it, means a lot!

No, it is working as mentioned:

Just recheck the later modelled loop part, when iterating over the array

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

1 Like

Oh yeah you’re absoloutely right, my bad. You’re da real MVP. I will try to solve that myself.

I’ll leave this up anyways. Maybe it helps sb. It would have helped me.

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