WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. This documentation is for WSO2 Complex Event Processor 4.1.0. View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Syntax<bool> ifThenElse(<bool> condition<int|long|float|double|string|bool|object> arg1, <int|long|float|double|string|bool|object> arg2)
Extension TypeFunction
Description

Return Returns the the value of the arg1 parameter if the condition parameter is set to true, or return returns the value of the arg2 parameter if the condition parameter is set to false.

Parameters
  • condition: This specifies the if then else condition value. The data type of for this value : parameter is bool
  • arg1: The parameter This specifies the value to be return returned if the value of the condition value parameter is true. The data type of this value one of the following : he value specified should be int, long, float, double, string, bool, or object.
  • arg2: The parameter This specifies the value to be return returned if the value of the condition value parameter is false. The data type of this value one of the following : he value specified should be int, long, float, double, string, bool, or object.
Return Type

Returns <int|long|float|double|string|bool|object>arg1 if the value of the condition parameter is true, or  <int|long|float|double|string|bool|object> arg2  if the value of the condition parameter is false.

Examples
  • ifThenElse(sensorValue > 35,'High','Low') returns 'High' for ' if sensorValue = 50'.
  • ifThenElse(voltage < 5, 0, 1) returns '1' for ' if voltage= 12'.
  • ifThenElse(password == 'admin', true, false) returns 'true' for ' if password = admin'.