on 07-22-2020 11:33 AM
Hi,
I am doing a API request and getting an array as response and I want to compare the array entries something like
currently i am restricted to compare only one value,
how to include multiple conditions like nested if conditions,
do we have nested scripting in CAI where i can compare multiple values and show output accordingly
and also how can use variable of variable for ex. results[number] where results is an array and number is an variable initialized in the memory, something like : {{results[ {{number}} ]}}
Thanks
Kishore
Hi Kishore,
you can actually chain the conditions by using "{{else eq api_service_response.... '02'}}".
See the handlebars documentation for details: https://handlebarsjs.com/guide/block-helpers.html#conditionals. I'll check if it makes sense to add this to the scripting documentation.
Regarding your second question, you can use the "itemAt" helper to access an array element dynamically, e.g, "{{itemAt results number}}".
Regards
Jonas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am trying to consume the following file
https://sampleserver5.arcgisonline.com/arcgis/rest/services/?f=pjson
I need to get records when the "type": "MapServer". I tried to use the if condition and with but without success,
{ "type": "carousel", "delay": "", "content": [ {{#eachJoin api_service_response.default.body.services}} { "title": "{{name}}", "subtitle": "$ {{type}}", "imageUrl": "", "buttons": [ { "title": "Buy", "value": "Buy", "type": "postback" } ] }{{/eachJoin}} ] }
can you advise pls
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.