anyone know how to solve this ?
i’m trying to get a batch of numbers from api and list it to excel
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,
- Using a for loop you can add each value in arrListOfAccNum with accountNumber
- You can use String.Join(" ",arrListOfAccNum) which will convert arrListOfAccNum to a string with spaces in between
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.
Cheers
“{”“accountNumber”“:”“+item.ToString+”“}”
Seems you should learn first how ForEach activity works.
https://docs.uipath.com/activities/other/latest/workflow/for-each
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.