cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

I want to loop a skill, so I created variable "i" and set to 0 and "n" and set to "{{length api_service_response.products.body.value}}" and calling a skill which is having the IF condition that is

but it is not taking n value as integer value, and i am getting the error

so I have changed the condition and calling the same skill but still facing recursion error

Basically i want to use the memory variable "i" in "{{api_service_response.products.body.value.[memory.i].ProductID}}" and print an array of values by recursion, I am getting result as null,

how to do print array values dynamically in CAI, how to change string values to integer values?

you can find the bot here https://cai.tools.sap/kishorech/recursionbot/train/intents

can you help me here
Thanks
Kishore

0 Likes
View Entire Topic
JonasB
Advisor
Advisor
0 Likes

Hi Kishore,

in the Edit Memory action, scripting can currently only be used inside strings, so you cannot use it to put a variable as number into the memory. This will be changed in a future release by providing the option to use scripting for building up the JSON.

In regards to the recursion I don't fully understand what you're trying to achieve. I think the error message is quite clearly saying that you should not use a go-to action pointing to the same skill. Why don't you use a loop as part of the scripting instead?

Regards
Jonas

former_member671720
Participant
0 Likes

Hi jonas.brand, Thanks for your response,

I am doing an API get request and the response has an array, so I want to have show output as LIST for each entry of the response array and not as a single TEXT output, so i am trying to do recursion by giving condition as response array length which is a dynamic value.

ex: if my array is having 6 entries, then i would like to print 6 LIST's to the chat output ...like this shown below

I know as of now in CAI we don't have this functionality. So, I am trying to show output in a list but by passing different index value on each call,

so I have created a variable i and set it to zero and

and i am doing increment by one in each call i am printing {{api_service_response.products.body.value.[memory.i].ProductName}} in place of {{api_service_response.products.body.value.[INDEX].ProductName}} in the List.

so that i can get the output as

Is there any other way that i can show my array entry as a LIST with out doing the recursion ?

is there any better way of doing the recursion ?

Please let me know if this is possible

Thanks

Kishore