Conditional If Statement handling "null"

Conditional If Statement handling "null"

Hi,

If I try to use a conditional if statement it will not let me use "null", like:
  1. input.Date_Field = if(input.Other_Date_Field != null, input.Other_Date_Field.addday(2),null);

I get "Both the argument should be same type for 'IF' task. Expecting 'IF' expression found 'TIMESTAMP' expression"

But I can write a normal if statement like:

  1. if input.Other_Date_Field != null
  2. {
  3.       input.Date_Field = input.Other_Date_Field.addday(2);
  4. }
  5. else
  6. {
  7.       input.Date_Field = null;
  8. }
Please allow for "null" in conditional if statements where appropriate.

Thanks,
Damien Cregan
Hire an Expert