简体   繁体   English

Crystal Reports公式-用文本替换Null值

[英]Crystal Reports Formula - Replacing Null value with Text

So, I'm much more familiar with Transact-SQL than I am with Crystal formulas. 因此,比起Crystal公式,我对Transact-SQL更加熟悉。 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: . 我想做的就是转换类似下面的SQL where子句的内容,以便在Crystal中使用该子句来有条件地禁止某个部分:。 . . AND (osAddressUse.Description <> 'Conservator Address' OR ( ISNULL(bcDocumentDetail.PrimaryStreet,'') = ISNULL(osaddress.PrimaryStreet,'') AND ISNULL(bcDocumentDetail.SecondaryStreet,'') = ISNULL(bcDocumentDetail.SecondaryStreet,'') ) ) . AND(osAddressUse.Description <>'Conservator Address'或(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. 基本上,只有在osAddressUse.Description =“ Conservator Address”或两个表bcDocumentDetail和osAddress中的主要街道和次要街道都不相同时,才显示此部分。

What I came up with so far is the following, but it doesn't work 100% of the time: 到目前为止,我想到的是以下内容,但并非100%的时间有效:

{osAddressUse.Description} <> "Conservator Address" OR ( {bcDocumentDetail.PrimaryStreet} = {osAddress.PrimaryStreet} AND {bcDocumentDetail.SecondaryStreet} = {osAddress.SecondaryStreet} ) {osAddressUse.Description} <>“保存者地址”或({bcDocumentDetail.PrimaryStreet} = {osAddress.PrimaryStreet}和{bcDocumentDetail.SecondaryStreet} = {osAddress.SecondaryStreet})

There are some situations where the data in these fields can either be NULL or "". 在某些情况下,这些字段中的数据可以为NULL或“”。 If it's a NULL value, I want it converted to "", that way, they technically match, and the section will be suppressed. 如果它是NULL值,则我希望将其转换为“”,这样,它们在技术上会匹配,并且该节将被取消。

Nevermind. 没关系。 I was able to figure it out: 我能够弄清楚:

TRIM ({osAddressUse.Description}) <> "Conservator Address" TRIM({osAddressUse.Description})<>“保护者地址”
OR 要么
(
(IF ISNULL({osAddress.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet}) = (IF ISNULL({bcDocumentDetail.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet}) (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}) (IF ISNULL({osAddress.SecondaryStreet})THEN“” ELSE {osAddress.SecondaryStreet})=(IF ISNULL({bcDocumentDetail.SecondaryStreet})THEN“” ELSE {osAddress.SecondaryStreet})
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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