简体   繁体   中英

NULL values in Crystal Reports

I am trying to produce a Crystal Report showing MAIN and ALTERNATE contact details for our customers.

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. So, to summarise, all customers will have a MAIN address but only some will MAIN and ALTERNATE addresses.

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).

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.

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

'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

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

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