简体   繁体   English

为什么当加入的实体为空时水晶报表不显示字段

[英]why is crystal report not displaying fields when joined entity is null

In my crystal report, which is linked to a SQL Server Database via a DataSet (*.xsd-File) , I am displaying data from several tables.在通过DataSet (*.xsd-File)链接到SQL Server Database水晶报表中,我显示了来自多个表的数据。 It also has some sub reports.它还有一些子报告。

In the main report, I display data from two tables.在主报告中,我显示来自两个表的数据。 When there is a record to display for both tables it works, but when there is only a record in the first table and the corresponding record in the other table is null (which is ok), it displays none data.当两个表都显示一条记录时,它可以工作,但是当第一个表中只有一条记录而另一个表中的相应记录为空时(可以),它不显示任何数据。

Example:例子:

Let's say I have a table Person and Address .假设我有一个表PersonAddress A Person can have an Address, but it can be empty (null) as well.一个人可以有一个地址,但它也可以是空的(空)。

When I want to display a report for a Person , which has an Address , it displays all wanted fields (like Person.Name, Person.Age, Address.Street etc.) .当我想显示具有AddressPersonAddress ,它会显示所有需要的fields (like Person.Name, Person.Age, Address.Street etc.)

If I want to display a report for a Person, which has no Address, it obviously cannot display any address data, but it also doesn't display the person's fields.如果我想显示一个没有地址的人员的报告,它显然不能显示任何地址数据,但它也不显示人员的字段。

What could be the cause for this?这可能是什么原因?

Can I improve my question to clarify something?我可以改进我的问题以澄清一些事情吗? I am using VS2010.我正在使用 VS2010。

I found out, what was wrong and did the following to correct it:我发现出了什么问题,并采取了以下措施来纠正它:

In Visual Studio 2010, when you opened the rpt-File, click in the menu on Crystal Reports and open Database > Database Expert... There you have to switch to the Links tab and there I had to reverse the link between my two tables and change in the link options the Join Type from "Inner Join" to " Left Outer Join ".在 Visual Studio 2010 中,当您打开 rpt-File 时,单击 Crystal Reports 上的菜单并打开数据库 > 数据库专家...在那里您必须切换到链接选项卡,我必须在我的两个表之间反转链接并在链接选项中将连接类型从“内部连接”更改为“左外部连接”。

After I did that, it worked as I expected.在我这样做之后,它按我的预期工作。

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

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