BAQ Calculated Field - If selected field is null, select another

I would like to add a Calculated Field to a BAQ I’m developing, and in that field I’m trying to conditionally select PartPlant.PersonID only when JobHead.PersonID is null, otherwise just select JobHead.PersonID.

This is the code from the calculated field: (case when (JobHead.PersonID = ‘’) then (PartPlant.PersonID) else (JobHead.PersonID) end)

However, when I use that code, it just selects JobHead.PersonID for all rows. I’ve already tried writing the when as JobHead.PersonID = null, and that didn’t work either. Syntax Checker says it’s OK as well.

I would really appreciate your feedback!


@chris.marinello Whenever you test for a NULL, you have to use the “IS NULL” syntax:


case when JobHead.PersonID = ‘’ or JobHead.PersonID IS NULL
else (JobHead.PersonID)

That worked…thanks Matthew!