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.

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.

Example 1:

Step 1: Create an empty when_null_example_1 using AIOps studio as shown in the below screenshot.

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. ##### 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, as default when an IP address is null @dm:empty --> @dm:addrow ipaddress = '' & hostname = 'host-1-1' & id = 'a1' --> @dm:addrow ipaddress = '' & id = 'a2' --> @dm:addrow ipaddress = '' & 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 = ''

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

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

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 and prints the output for each dataset (or row) as shown in the following screenshot.

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.

Last updated