How does Firebird conditional IIF statements test for NULL?

Does anyone know how Firebird tests for Null (or Empty)? The following statement doesn’t work:

IIf(IsNull("fldWorkTime"),"","Work Time: " & "fldWorkTime") AS WorkTime

fldWorkTime is a Text field.


Did you try the Firebird documentation?

1 Like

You have a number of issues with the statement.
Test with IS NULL.
Surround text (literals) with apostrophes. Quotes are for field & table names.
Use pipes (||) not ampersand.

IIf("fldWorkTime" IS NULL,'', 'Work Time: ' || "fldWorkTime") AS WorkTime

Thank you, @robleyd I actually did check this site first, but a search on the page for “IIF” didn’t yield results, so I didn’t keep going. It’s a great site, though… have definitely bookmarked it!

Works perfectly! Thanks, @Ratslinger … you’re a wealth of information. I don’t know how you keep it all straight.

As @robleyd directed you to the NULL page, going back one page is the main documentation → Firebird: Firebird RDBMS.
Get the 3.0 language reference. You’ll find it can be very helpful.

Thank you!