cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle NULL

amit_saroha
New Contributor III

Hi,

I have the below expression but sometimes it can be NULL instead of ‘S’. Could you please suggest how to handle the NULL in the below expression?

$input0.final_document.Pipeline_Status==‘S’ && $input1.final_document.Pipeline_Status==‘S’ && $input2.final_document.Pipeline_Status==‘S’

6 REPLIES 6

Supratim
Contributor III

You can use $.hasOwnProperty(‘input0.final_document.Pipeline_Status’) It will gives you true if value is not null.

amit_saroha
New Contributor III

@Supratim, Thanks for the inputs. My requirement is to handle both things e.g. I want to assign the value ‘S’ in mapper if it’s NULL OR its S.

How I can do it, please suggest.

($input0.final_document.Pipeline_Status==‘S’ OR NULL) && ($input1.final_document.Pipeline_Status==‘S’ OR NULL) && ($input2.final_document.Pipeline_Status==‘S’ OR NULL)

Hi @amit.saroha
You mean you want to fill the fields with S if it’s null?

Then you should use an if else
$input0.final_document.Pipeline_Status == NULL ? S : $input0.final_document.Pipeline_Status

You’re quite close:

($input0.final_document.Pipeline_Status=='S' || $input0.final_document.Pipeline_Status== null) && ($input1.final_document.Pipeline_Status=='S' || $input1.final_document.Pipeline_Status== null) && ($input2.final_document.Pipeline_Status=='S' || $input2.final_document.Pipeline_Status== null)

Or, other thing that you can try is the following:

$input0.final_document.Pipeline_Status matches 'S'|null && $input1.final_document.Pipeline_Status matches 'S'|null && $input2.final_document.Pipeline_Status matches 'S'|null