简体   繁体   English

Crystal Reports中的NULL值

[英]NULL values in Crystal Reports

I am trying to produce a Crystal Report showing MAIN and ALTERNATE contact details for our customers. 我正在尝试生成一个Crystal报告,为我们的客户显示主要和替代联系方式。

All works fine if the customer has both types of addresses (ie MAIN and ALTERNATE) but no report comes out at all for customers who only have a MAIN address. 如果客户具有两种类型的地址(即MAIN和ALTERNATE),则所有方法都可以正常工作,但对于仅具有MAIN地址的客户,根本没有任何报告。 So, to summarise, all customers will have a MAIN address but only some will MAIN and ALTERNATE addresses. 因此,总而言之,所有客户都会有一个MAIN地址,但只有一些会拥有MAIN和ALTERNATE地址。

I need to get the report to print sheets for all customers where or not the second address (in this case in our database as Addresses2.AddressType is ALTERNATE or NULL). 我需要获取报告以为所有没有第二个地址的客户打印表格(在本例中,数据库中的Addresses2.AddressType为ALTERNATE或NULL)。

My selection formula is shown below: 我的选择公式如下所示:

{SubscriptionMembers.Current} and
{Categories.CategoryType} = "M" and
{SubscriptionMembers.MainSubscription} and
{Addresses.AddressType} in ["MAIN"] and
{Addresses2.AddressType} in ["ALTERNATE"] and
{Addresses.Country} = "United Kingdom" and
not {SubscriptionMembers.Lapsed} and
not {Contacts.Deleted}

我建议使用包含(isnull({Addresses2.AddressType},'ALTERNATE'))之类的SQL Expression Field,并在记录选择公式中使用此字段-这样,您就不必依赖于有关处理NULL值等的报告选项。

Because only some have an 'Alternative address', the selection formula is only going to show customers with a 'main' AND 'alternative'. 因为只有一些具有“备用地址”,所以选择公式仅向客户显示“主”和“备用”地址。

I assume every customer has a main address A way I would deal with this is take out {Addresses2.AddressType} in ["ALTERNATE"] and and just drop the 'alternative' address details in the same section(group) as the main address. 我假设每个客户都有一个主地址。我要解决的方法是{Addresses2.AddressType} in ["ALTERNATE"] and取出{Addresses2.AddressType} in ["ALTERNATE"] and在与主地址相同的部分(组)中删除“替代”地址详细信息。

As long as these are linked correctly it will display every customer from your other selection parameters, therefore will show 'main' and the customers who have an 'alternative' address. 只要这些链接正确,它将显示您其他选择参数中的每个客户,因此将显示“主要”和具有“替代”地址的客户。 How it should look: 外观如何:

Group - CustomerID 组-客户ID

'MAIN' address details here               'ALTERNATE' address details here

Group - Details 组-详细信息

'DATA' here

Since you need To get customer in either case then one way would be dont take address in record selection formula. 由于无论哪种情况都需要获得客户,因此一种方法是不在记录选择公式中使用地址。 Instead create a formula as to check null for address2 而是创建一个公式来检查address2是否为null

If isnull ({Addresses2.AddressType} in ["ALTERNATE"]) then your code Else If (Addresses.AddressType} in ["MAIN"] or {Addresses2.AddressType} in ["ALTERNATE"]) Then your calculation

This way you can handle easily 这样您可以轻松处理

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

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