Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Does Apigee support looping an array inside condition tag?

Not applicable

Example find if objectId(112) is in Array(112,133,144), it should return true for condition.

0 13 967
13 REPLIES 13

Former Community Member
Not applicable

You can use a regular expression

Regex within array ? How would that work.

Former Community Member
Not applicable

No, RegEx works on strings. I'm assuming you're dealing with a JSON Array. Treat the array as a string.

I am sorry but I am not sure how would that work in Conditional Flow. Can you please give an example ?

Not applicable

Hello @ravneetsidhu1

You can try something like this:

if(Array.indexOf("112") != -1)
	return true;

Yup, but that would be in a JS script. My question was if we can do similar comparison in conditional flow statement

@ravneetsidhu1 , @MEGHDEEP BASU was referring to Javascript policy in Apigee Edge.

Thanks @Anil Sagar.

@ravneetsidhu1, I did not get why you wanted to execute this check in the conditional flow statement on the proxy flow ? I would consider placing a javascript with the condition, set the result in a context variable in the preflow.request and then check that variable in the conditional flow, until you are trying to solve a specific use case, which I am not aware of.

@MEGHDEEP BASU : Sorry for the confusion. I am just learning Apigee and wanted to see if the platform provides that capability. I understand your point now. Thanks 🙂

@ravneetsidhu1 , No Issues, In fact it's a great Question, Any Question is welcome in Apigee Community 🙂 Keep us posted moving forward if any.

@ravneetsidhu1 , Short Answer is NO. You need to do same in Javascript & store the result in flow variable using context.setVariable("arrayResult", true/false) , use the flow variable of the result in condition.

@ravneetsidhu1 , Short Answer is NO. See similar question asked here. See comments below question for more details. Hope it helps.

Thanks for the link. I think we have to initiate a JS script to do comparison and then return Flag which would give the flow its direction.