BAQ Calculated Field Blank

I saw a few other posts about this…so quite possibly this is a bug as mentioned in other posts. However, just a quick question. I have a BAQ in which I have a Calulated field that I concatenate several fields together. See image below. Sometimes the calculated field will be blank and sometimes it will work as intended. Any ideas?

If one of those fields are null, I think that may mess it up.

2 Likes

Wrap your fields in ISNULL() to return an empty string if they are null and it should work

Another thing you could try is using CONCAT() around your entire statement. SQL 2012 + supports concatenating null strings. You’d do this instead of adding the strings.

2 Likes

@Mark_Wonsil @Aaron_Moreng Yes, thank you! You guys are so smart! Attached is my revised calculated field which works.

1 Like

I just looked up the ISNULL() reference for Transact-SQL, and see that it returns that type being checked. I always thought it returned a Boolean.

It also appears that you can provide a value to return if the expression being checked is in fact null.

Where I used to have code like:

(case when  (JobMtl.MtlSeq) is null then 0 else JobMtl.MtlSeq end)

I can now do with

ISNULL(JobMtl.MtlSeq,0)
1 Like