Apama 10.3.1 | Apama Documentation | Developing Apama Applications | EPL Reference | Statements | Compound statements | The ifpresent statement
 
The ifpresent statement
The ifpresent statement is used to check if one or more values are empty. It unpacks the values into new local variables and conditionally executes a block of code.
If all of the expressions are non-empty, then their values are unpacked into new local variables (in the scope of the first block of the ifpresent statement) and the first block of code is executed. If the expression is a simple identifier (that is, it is referring to a variable or parameter) or casting an any type, then the as identifier part can be omitted; the new local retains the same name. An optional else block is executed if any of the expressions have an empty value.
ifpresent operates on expressions of the following types:
*optional (in which case the new local variable is of the unpacked type)
*chunk (ifpresent treats chunk as empty only if its value is the default value)
*stream (ifpresent treats stream as empty if its value is the default value or if it has been quit)
*listener (ifpresent treats listener as empty if its value is the default value or if it has been quit)
*context ( ifpresent treats context as empty only if its value is the default value)
*action (ifpresent treats action as empty only if its value is the default value)
*any (ifpresent treats any as empty only if it has an empty value)
See the API Reference for EPL (ApamaDoc) for more information on these types.
For more information on the default values, see Default values for types.
For more information on the ifpresent statement, see Defining conditional logic with the ifpresent statement.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.