# When\_Null

**when\_null**\
If the specified value is null, it uses the value as per 'value' \
param @param value Type can be string or number. Input can be of any type.<br>

This function can be used when the dataset needs a default value when the dataset column value has null values and the user wants to substitute a default value.&#x20;

#### Example 1:&#x20;

Step 1: Create an empty **when\_null\_example\_1** using AIOps studio as shown in the below screenshot.

![Empty pipeline](/files/-MeW9MkwKAlJoYYb3Nd_)

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a set of records with IP Addresses and hostnames (with`*\
*`##### some null values for demonstration`*\
*`##### RDA function when_null is used to demo this example.`*\
\
*`##### This pipeline adds couple of rows with IP Addresses and hostnames`* \
*`##### with some null values. Uses dm function 'when_null' to check for any`*\
*`##### null values for hostnames and substitute localhost as default value`*\
*`##### Also, 127.0.0.1 as default when an IP address is null`*\
\
*`@dm:empty`* \
*`--> @dm:addrow ipaddress = '10.10.1.1' & hostname = 'host-1-1' & id = 'a1'`*\
*`--> @dm:addrow ipaddress = '10.10.1.2' & id = 'a2'`*\
*`--> @dm:addrow ipaddress = '10.10.1.3' & id = 'a3'`*\
*`--> @dm:addrow hostname = 'host-4-4' & id = 'a4'`*\
*`--> @dm:addrow id = 'a5'`*\
*`--> @dm:map from = 'hostname' & to = 'Hostname' & func = 'when_null' & value = 'localhost'`*\
*`--> @dm:map from = 'ipaddress' & to = 'IP Address' & func = 'when_null' & value = '127.0.0.1'`*

![Pipeline code added to empty pipeline created](/files/-MeWAoCuy2gPtn4GYL5l)

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeline code is verified using 'Verify' button as shown above.](/files/-MeWBHXTJ31T7z2ddPGO)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

![Successful execution of pipeline without any errors](/files/-MeWBkSNIacfJtQi4PPH)

Step 5: RDA uses the dm function 'when\_null' to substitute the default value specified by the user for both hostname (as localhost) and IP Address (as 127.0.0.1) and prints the output for each dataset (or row) as shown in the following screenshot.<br>

![Successful execution of pipeline using dm function 'when\_null' and prints output ](/files/-MeWCuObBkaNHPpAyYGj)

This function will be useful when the dataset column values are nulls and the user wants to substitute with a default value for further processing in the pipeline.


---

# 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://docs.cloudfabrix.io/rda/rda-userguide/rda-aiops-studio/examples-jupyter/data-mapping-cfxdm-dm-functions/when_null.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.
