// This module is included in the following assemblies:
// as_evaluating-integration-data-to-determine-execution-flow.adoc

[id='using-advanced-expression-builder_{context}']
= Using the advanced expression builder to specify conditions

In a flow, add a *Conditional Flows* step when you want to evaluate
incoming data to determine the integration's execution path. The procedure
described here shows how to use the advanced expression builder to 
specify conditional expressions in Camel Simple Language. 

.Prerequisites

* You are creating or editing a primary flow. If this is a simple integration, 
the start and finish connections have been added.  
* Input to a *Conditional Flows* step
must be an individual message. In the integration visualization, 
if the previous step's *Data Type* shows *(Collection)*, add a *Split* step. 
* You are familiar with the fields that will be in the messages that the 
integration passes to the *Conditional Flows* step you are about to add.  
* You are familiar with the 
link:http://camel.apache.org/simple.html[Camel Simple Expression] language
or you have expressions for the conditions that you want to evaluate. 

.Procedure

. In the integration visualization, where you want to add a *Conditional Flows* step,
click image:images/integrating-applications/PlusSignToAddStepOrConnection.png[title='plus sign'].
. Click *Conditional Flows*.
. Click *Select* in the *Advanced expression builder* entry. 
. In the *Configure Conditional Flows* page, define one or more conditions: 
.. In the initial *When* field, enter a Camel Simple Language conditional expression. For example, 
the following expression evaluates to true when the body of the message
contains a `pto` field that is greater than `160`:
+
----
${body.pto} > 160
----
+
When this expression evaluates to true, the integration executes the 
conditional flow that you create and associate with this condition. 
+
[NOTE]
====
In an expression, an additional property specification is required when 
the *Conditional Flows* step is in one of the following kinds of flows: 

* An API provider integration operation flow
* A simple integration that starts with a webhook connection
* A simple integration that starts with a custom REST API connection

In these flows, {prodname} wraps the actual message content inside a `body` 
property. This means that the input to a *Conditional Flows* step contains a 
`body` property that contains another `body` property that contains 
the actual message content. Consequently, in an expression that is in a 
*Conditional Flows* step that is in one of these kinds of flows, 
you must specify two instances of `body`. For example, suppose you want 
to evaluate content that is in the `pto` field of the input message. 
Specify the expression like this: 

----
${body.body.pto} > 160
----
====

.. Optional. Click *Add another condition*, and repeat the previous 
step. Do this for each additional condition that you want to define.

.. Optional. Change the order in which the *Conditional Flows* step evaluates
the defined conditions by clicking the up or down arrow to the right of a 
condition field. 
 
.. Optional. Click *Execute default flow* if you want there to be a 
default conditional flow. 
+
If you select *Execute default flow*, during execution, 
if none of the conditions that you specified evaluates
to true, the integration executes the default conditional flow. If you do
not select *Execute default flow*, during execution, if none of the 
conditions that you specified evaluates to true, the integration continues 
execution with the step that follows this *Conditional Flows* step.

. Click *Next*. 
. Optional. Specify the output data type if {prodname} prompts for it. 
All conditional flows that are part of this *Conditional Flows* step
must have the same output type. 

. Click *Next*.
+
{prodname} displays the flow visualization. Below the *Conditional Flows* step
that you are adding, there is an entry for each condition that you specified, 
as well as an entry for an *Otherwise* default flow if you indicated that the 
*Conditional Flows* step has a default flow. 


.Next step

For each condition, add steps to its associated flow. If there is a default flow, 
add steps to the default flow. 

.Additional resources
 
link:https://camel.apache.org/manual/latest/simple-language.html#_operator_support[Camel Simple Language operators]. 


 
