How to: String / genericvalue to String[]

Hi there,

i’m reading a info from cell in Excel - which gives me output genericValue. I need to use this value for Excel -Filter table → FilterOption where String is the only supported variable type.

UiPath is obviously saying that it cannot convert it to 1-dimensional array.

Any suggestion please?

Hi @mchlebik,

create one String[] variable → arrstring
your string/genericvaluestrvalue
use assign activity
arrstring={strvalue.ToString()}

Regards,
Arivu :slight_smile:

Hi there @mchlebik,
As noted by @arivu96, you can create an Array(Of String) and add your value there.

Alternatively, you can achieve this by adding the below directly into your ‘FilterOptions’ property:
{genericValue.ToString()}

Thanks in advance,
Josh

Thanks @Mr_JDavey and @arivu96 . This partially solved my issue.

Even though i dont have any validation errors, the FilterOption is not working (with the dynamic configuration)

If I use an Array(of String) manually / hardcoded - {“FREIGHTSOFT”, “GRP”} - the Excel is filtered as it should.

image

But if I’m using the array, which I gather from the cell (read cell) - the Excel is filtered by some thing which is not in the Column.
image

I have no idea where is the issue - any ideas?

Hi there @mchlebik,
Do you mean you are extracting the information:
{“FREIGHTSOFT”, “GRP”}

From a workbook, then attempting to use that for filtering?

If so, you will end up with an Array(Of String) similar to the below:
{“{FREIGHTSOFT, GRP}”}

As such, there is no field that matches:
{FREIGHTSOFT, GRP}

Thanks,
Josh

Thanks Josh → you rock :slight_smile: - this was the issue, that I had additional characters there.

PS:Since I dont know any better.

From the excel cell 1 - im taking first filter and from cell 2 im taking second filter.

image

image

With this I have the dynamic filter.

Thanks a lot once again.

1 Like