nested condition sample

Hi There,

How could i have a nested condition.For example,see below.Could you pls provide a sample for it.

if(true) {

if(true) {

return "something";

else{

return "somethingElse";

}

}

else {

if(true) { return "else's something"}

else { return "excute if all the failed"}

}

0 5 238
5 REPLIES 5

sidd-harth
Participant V

You need to add more context to your question.

Explain your requirement and how/where this condition is used in the scenario?

Is this a basic JavaScript question?

If so, this link might help:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else

I know how to write control statements in java script,apparently I was looking how could we achieve this basic if -elseif-elseif...so on, in apiGee proxy conditional flows.Is there any samples i can refer it pls?

This documentation describes the Condition element.

There is no possibility, currently, to nest Condition elements.

For instance take a look at below json object, would like to get the employeeGroup and want to perform the following conditions using conditional flow.

var employeeGroup= $.employeGroup; ( will extract from below jsonObj using resp.content)

if(employeeGroup !== empty/undefined) {

if(employeeGroup==='controlctor') {

return 'did some thing';

}

else (employeeGroup==='controlctor') {

return 'did some thing';

}

}

else{

return 'custom fault such as employeeGroup is required'

}

====

Below is an json employe object

{

"employename" : "xyz",

"employeID" : "344",

"employeGroup": ,

"employeType" : "fulltime" and so on

}