In my DB, some of values of a column (called status) are null, and if they are null, I want to show a String "canceled".
Guess I need to do it on Attributes
- common
-if-null
but then don't know how to specify it.
Can anyone help me?
There are multiple options, as you said, Attributes
- common
- if-null
on the field containing the status should do that, you can specify a String by entering it in the Value box. If your string disappears after unfocusing, click the ...
while the Value entry is selected, that will launch a Popup-entrybox.
Alternatively, you could put that logic into your query
select coalesce(status, 'Cancelled')
from table
COALESCE
Evaluates the arguments in order and returns the current value of the first expression that initially doesn't evaluate to NULL. For example, SELECT COALESCE(NULL, NULL, 'third_value', 'fourth_value'); returns the third value because the third value is the first value that isn't null.
Some databases might have similar functions with different names, with Oracle e.g. there's nvl()