Add a null to expressions

In some cases, I want to allow a null value to be the result of an expression.

This is already an option for special cases as the NULLIF()funktion.

However a common case is something like this:

if(@Variable.status  = 'released', @App info.Current Date and Time , {null}) 

I have 10 record fields to save to and one or two of them are dependent on other values. Then I don’t want to add more and more triggers because I don’t want the redundancy, and maintenance overhead.

The only workaround I found is to use the NULLIF() function with dummy values to create a “date-type-null-value” (NULLIF(1,1) does not work for dates because 1 is not a date)…

if(@Variable.status  = 'released', @App info.Current Date and Time , nullif(@Table record.CurrentRecord.Date Created , @Table record.CurrentRecord.Date Created ))

please make null a valid null value as a possible expression result!

A secondary use for this would be to allow null detection i.e.
If @Variable = {null} Then Show Message “No Value Returned”

It would be useful if it were able to be located under Static Value in selections

Great idea, however there is already the function ISNULL()

IF( ISNULL( @variable.xyz), true, false)

Extra special sauce for you @thorsten.langner on the date problem. Shouldn’t be this hard but hopefully this helps others in the future!

nullif(texttodatetime(if(@Variable.Selected SAP Batch v4.Date of Manufacture  = '', '1900-01-01', @Variable.Selected SAP Batch v4.Date of Manufacture ), 'YYYY-MM-DD'), texttodatetime('1900-01-01', 'YYYY-MM-DD'))

Yes thats basically what I did.

nullif(@App info.Current Date and Time , @App info.Current Date and Time )

Any date variable compared with itself will work in the NULLIF()
But this is

  • not intuitive
  • hard to read
  • an additional dependency to maintain
  • more complex, since you need to hit the correct datatype

…

Or have I misunderstood what you’re getting at?

You’re correct, Thorsten. This was just a unique variant where we were parsing a string to a null date and not a null string.