How to deal with NULL values

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
jannes
Posts: 100
Joined: Tue Jul 02, 2019 12:22 pm

How to deal with NULL values

Post by jannes »

How to deal with NULL values in rules ?
Is it possible to use "DECODE" or "NVL" like in Oracle..?

Example : find records sorted on date_input, when empty use current-date :

FIND <table> WHERE <..> ORDER BY NVL(date_input, CURRENT_DATE)
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: How to deal with NULL values

Post by customaware »

FIND MyRecord WHERE (MyRecord.MyDate=DateInput OR MyRecord.MyDate IS UNDEFINED)
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
jannes
Posts: 100
Joined: Tue Jul 02, 2019 12:22 pm

Re: How to deal with NULL values

Post by jannes »

The question is :

Are there functions like in other languages like

- NVL(value, 'Something')

- CASE WHEN a=b THEN ..

- DECODE(supplier_id, 10000, 'IBM',
10001, 'Microsoft',
10002, 'Hewlett Packard',
'Gateway') result

So they can be used in ORDER BY etc..

Or do we have to add and use Calculated Fields in the Business Objects for this ?
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: How to deal with NULL values

Post by customaware »

There are plenty of functions and way to do almost anything Jannes.

It really depends on how and where you want to use it.

For example.

NVL(value, ‘something’)

So if you want some attribute, let’s call it result, to equal a value if it is not Null and equal something if the value is Null...

In the BO rule...

If MyBO.Value IS UNDEFINED Then
MyBO.Result = ‘something’
Else
MyBO.Result = MyBO.Value

There is no CASE in Aware but there is nested IF THEN ELSE

There are many very cool things that make life easier also such as IN and CONTAINS

If MyBO.Value IN ‘Red, Blue, Green’ then.....

If you get stuck with something then don’t hesitate to ask.

This is an awesome group if seriously clever Aware minds and it is rare that they cannot come up with a solution.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Post Reply