If (Double)

Name

If (Double)

Syntax

If (Boolean condition, Real thenValue, Real elseValue)

Purpose

To evaluate a given condition and if true, return result of thenValue. Otherwise, to return the result of elseValue.

Description

Returns the value of ‘Then’ expression or ‘Else’ expression depending on the value of condition.

Return Type

Double

Parameters

Condition [System.Boolean] – Condition that is evaluated

thenValue [System.Double] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.

elseValue [System.Double] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.

Example

We have a Customers dataset which we will use to evaluate and transform the Items field.

In this example we will use the Expression object to define the condition, and a Variables object to define a real thenValue and a real elseValue.

Where,

Condition: Items = “1”

thenValue = 1.23

elseValue ­ = 2.23

In the output, you can see that real values, 1.23 and 2.23, have been returned depending on whether the Items field condition was met.

© Copyright 2023, Astera Software