简体   繁体   中英

Crystal Reports Formula - Replacing Null value with Text

So, I'm much more familiar with Transact-SQL than I am with Crystal formulas. What I would like to do is convert something like the following SQL where clause to be used in Crystal to conditionally suppress a section: . . . AND (osAddressUse.Description <> 'Conservator Address' OR ( ISNULL(bcDocumentDetail.PrimaryStreet,'') = ISNULL(osaddress.PrimaryStreet,'') AND ISNULL(bcDocumentDetail.SecondaryStreet,'') = ISNULL(bcDocumentDetail.SecondaryStreet,'') ) ) . . .

Basically, the section should only display if the osAddressUse.Description = "Conservator Address" OR both the Primary Street and Secondary Street within both tables bcDocumentDetail and osAddress are not identical.

What I came up with so far is the following, but it doesn't work 100% of the time:

{osAddressUse.Description} <> "Conservator Address" OR ( {bcDocumentDetail.PrimaryStreet} = {osAddress.PrimaryStreet} AND {bcDocumentDetail.SecondaryStreet} = {osAddress.SecondaryStreet} )

There are some situations where the data in these fields can either be NULL or "". If it's a NULL value, I want it converted to "", that way, they technically match, and the section will be suppressed.

Nevermind. I was able to figure it out:

TRIM ({osAddressUse.Description}) <> "Conservator Address"
OR
(
(IF ISNULL({osAddress.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet}) = (IF ISNULL({bcDocumentDetail.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet})
AND
(IF ISNULL({osAddress.SecondaryStreet}) THEN "" ELSE {osAddress.SecondaryStreet}) = (IF ISNULL({bcDocumentDetail.SecondaryStreet}) THEN "" ELSE {osAddress.SecondaryStreet})
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM