# If (Boolean)

| **Name**    | ***If (Boolean)***                                                                                                                                                                                                                                                                |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | If (Boolean condition, Boolean thenValue, Boolean 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 | Boolean                                                                                                                                                                                                                                                                           |
| Parameters  | <p>Condition \[System.Boolean]</p><p>thenValue \[System.Boolean] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.</p><p>elseValue \[System.Boolean] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.</p> |

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/0%20\(163\).png)

### **Example**

We have a *Customers* dataset which we will use to evaluate whether the *Country* field consists of the value “Germany”.

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/1%20\(164\).png)

We will use the *Expression* object to give this condition, and a *Variables* object to define *thenValue* and *elseValue*.

Where,

Condition: *Country* = “Germany”

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/2%20\(164\).png)

*thenValue* = True

*elseValue* ­ = False

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/3%20\(31\).png)

In the output, you can see that Boolean values, True and false, have been returned depending on whether the *Country* field condition was met.

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/4%20\(5\).png)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/astera-data-stack-v7/functions/logical/if-boolean.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
