How to: String / genericvalue to String[]

excel

#1

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?


#2

Hi @mchlebik,

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

Regards,
Arivu :slight_smile:


#3

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


#4

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?


#5

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


#6

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.