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)
How to deal with NULL values
-
- Posts: 2401
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: How to deal with NULL values
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....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: How to deal with NULL values
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 ?
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 ?
-
- Posts: 2401
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: How to deal with NULL values
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.
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....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....