Nested Condition in M2Doc

Hi,

I’m looking for the AQL syntax for nested conditions.
How can 2 conditions can be embedded?

Is there something like :

1- Using a logical operator

IF (condition1 and condition2)

2- Nested condition

IF (condition 1)
IF (condition2)

What are the AQL syntax?

Kind Regards

The if in AQL is a function and the else branch is mandatory:

if <expression> then <expression> else <expression> endif

If you want to nest if, you can use a if as one or both of the two last expressions:

if <expression> then if <expression> then <expression> else <expression> endif

else endif

or

if <expression> then <expression> else if <expression> then <expression> else <expression> endif

endif

The if statement in M2Doc support else if branches. You can also include other if statements in each statement block.

Thanks Yvan,

Any idea about the following IF statement issue based on INCLUDES on a collection? May be a service to add? Which one and how?

Kind Regards

The includes service is part of the AQL services, and you don’t need to import it explicitly. But it should be applied to a collection using the -> operator:

someExpressionReturningACollection->includes(someObject)

By the error message, I think you used the . operator instead of the -> operator.

Thanks Yvan,

It was an operator issue.