Managing Nulls in calculated fields or aggregates

Managing Nulls in calculated fields or aggregates

  

Anyone have a workaround for calculated fields on aggregates not having access to the integer Null conversion to zero?  In the aggregate we are using we have a left join so in the event the second table doesn't have row the aggregate returns 0 however the calculated field doesn't see the null integer so when using the field in an equation on the calculated field ( Ie field 1 - Field 2 (Null Field)) returns Null. 

We want to use a calculated field so we can sort on table.


Have tried converting the integer to text to do a string comparison to "" in an if statement.


  

Do you have screenshot?

I tried it myself but the right table in a left join always have value 0, not null.

AFAIK, Outsystems does not have null concept, blank integer will always have value of 0.

Solution

Hi,

The only solution is to validate the value before using.

Ex.Entity A and entity B

A With or without B

You want to sum two columns one of each entity.

So you do something like this in the calculated field:

A.Value + if(B.Id = NullIdentifier(), 0, B.Value)

This will work.

Cheers.

Solution

Eduardo Jauch wrote:

Hi,

The only solution is to validate the value before using.

Ex.Entity A and entity B

A With or without B

You want to sum two columns one of each entity.

So you do something like this in the calculated field:

A.Value + if(B.Id = NullIdentifier(), 0, B.Value)

This will work.

Cheers.

Ahh  clever test the id of the table not the value for null.  Works a treat thanks.