Not define for type string and 1-dimensional array

anyone know how to solve this ?
i’m trying to get a batch of numbers from api and list it to excel
image
image

Hi @shanti_18 ,

Noticed you’re trying to use an API, have you checked out the API Request and Response formats ?

If possible could you share the Request format ?

We need to model the List of account numbers as a String data with the format that is acceptable/present in the Request format of the API.

Since arrListOfAccNum is a array of String,

  1. Using a for loop you can add each value in arrListOfAccNum with accountNumber
  2. You can use String.Join(" ",arrListOfAccNum) which will convert arrListOfAccNum to a string with spaces in between
1 Like

1/ You can not indeed use Array(of string) in expression with “+” operator.
2/ What does the API accepts in “accountNumber”? Single account or list of accounts?
If single account: you will need to call the API multiple times for each account from the array.
If list of accounts: you will need to convert the array(of string) into a delimited string according API specification (e.g. as despribed @Quenton_Wayne_Rebello in point 2.)

Cheers

the api accepts single account only that’s why im trying to use for each to read every account on
the Variable in_listofaccountnamestring.

I just put 2 accounts for sample, but in_listofaccountnamestring will contain thousands of accounts.

API can only response for just 1 accountnumber, thats why im using for each.

in_listofaccountnamestring will have a thousand of number

I see. Then you need to use “item” instead of “arrListOfAccNum” in your API body expression.
image

Cheers

@shanti_18

“{”“accountNumber”“:”“+item.ToString+”“}”

1 Like

Seems you should learn first how ForEach activity works.

https://docs.uipath.com/activities/other/latest/workflow/for-each

1 Like

I get it now, but the problem is the for each only provide for the first account number.

Use debug mode and investigate value of “arrListOfAccNum” - if the array really contains multiple elements.

Cheers

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