当字段为 NULL 时连接两列

Concatenate two coulmns when the field is NULL

例如,我在 SQL 上执行了这样的代码。

Fruits--- Taste
Orange -- good
Apple --  Bad
Apple -- 
Apple --

然后

我去 Crystal 报告

我用 HTML TEXT 格式制作了一个公式字段

{FRUITS}+"<i>"+"&nbsp;&nbsp;&nbsp;&nbsp;"+{TASTE}+"</i>"

Crystal 报告仅显示

Orange   *good*
Apple    *Bad*

这两个苹果去哪儿了?
我假设因为 "TASTE" = NULL 因此,Crystal 报告删除了两个苹果。

如何在报告中显示这样的内容?

Orange   *good*
Apple    *Bad*
Apple
Apple

如果{TASTE}的值为NULL,则公式"crashes"因为NULL不能与字符串拼接。 因此,公式字段在报告中显示为空。

您可以通过检查 NULL 来解决这个问题。 更改公式如下:

If IsNull({TASTE}) Then
    {FRUITS}
Else
    {FRUITS}+"<i>"+"&nbsp;&nbsp;&nbsp;&nbsp;"+{TASTE}+"</i>"