Skip to Content

How to limit each loop in sap CAI


I am looping an api_response which is having dynamic entries greater than 20,

but I want to show only 10 list entries in the bot output, how to limit the output to 10,

is there any way i can pick the range of the output like loop the array only form 3rd entry to 6th entry some range kind of option.

can you help me here,


dynamic-list.png (82.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 30, 2020 at 07:15 AM

    Hi Kishore,

    in general any filtering or limiting of the results returned by the external service should ideally be done in the external service itself to make sure the response payload only contains the data the is actually required. In case of OData therefore $filter and $limit should be used to only fetch the required number of results. So you should first check if the external service you're calling supports any such option to limit the number of results.

    For sure there might be cases where it is not possible to limit the number of results returned. There is currently no handlebars helper available for "slicing" an array and we're happy to hear your use-cases for this to consider adding one. What you could do today is to make use of the {{@index}} keyword inside the each-loop to only return something when the index is in a certain range (e.g. {{#lt @index 20}}...{{/lt}})


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.