【问题标题】:Crystal Report with multiple datasources, one is emptyCrystal Report 有多个数据源,一个是空的
【发布时间】:2011-03-12 00:38:08
【问题描述】:

我有一个带有表格作为数据源的 Crystal 报表,我想包含另一个带有报表页脚详细信息的表格。

I have two data sources in the report which are not linked, but when the selection criteria returns no rows from the main table, the results from the non-empty non-linked source are also empty.

我怀疑它在两个数据源之间进行交叉连接,所以如果一个是空的,那么与另一个连接的也是空的。问题是我需要非空表中的行显示在报表页脚部分中,并且它们被另一个空数据源抑制。

How can I get rows from an independent table to show in the report footer when the selection criteria and their parameter choices return an empty result set in the main table?

感谢您的帮助,

-贝丝

另外,我尝试使用这样的命令作为数据源和 sql:

select * from waitlist
union all
select distinct null as reportID, null as ..., lastupdated
from waitlist

但它仍然为 lastupdated 返回 null 并在报表页脚中隐藏子报表。

【问题讨论】:

  • 您清除了数据库专家中的所有链接吗?
  • 是的。我想出了我需要做什么。我会用那个方法来回答这个问题。

标签: crystal-reports


【解决方案1】:

我最终将我的报告数据源设置为一个视图,该视图将另一行合并到表中。我还需要更改我的选择标准,以便允许该行通过。

这是我的数据源:

CREATE VIEW [dbo].[vw_rpt_waitlist] AS
select * from waitlist
union all
select distinct 
reportID, 
null as (fields...), 
lastupdated, 
'reserved' as countyName
from 
waitlist     

这是我的记录选择公式:

({vw_rpt_waitlist.countyName} = {?County} or 
 {vw_rpt_waitlist.countyName} = "reserved") and
{vw_rpt_waitlist.reportID} = 14

如果返回的是真实行,我也会取消详细信息部分:

formula = {vw_rpt_waitlist.countyName} = "reserved"

为了获得他们在报告页眉中选择的参数化县名,我正在使用:

dim t as string
dim c as string

if {vw_rpt_waitlist.countyName}="reserved" then
    c = {?County}(1)
else
    c = {vw_rpt_waitlist.countyName}
end if   

t = "Waitlist by " + {@serviceTitle} + " and Waiver Need Index as of "  
      + cstr({vw_rpt_waitlist.lastUpdated},"MM/dd/yyyy")

formula = t

由于“保留”县总是通过,子报表不会被抑制。

【讨论】:

    猜你喜欢
    • 2012-01-08
    • 2013-10-23
    • 2011-05-30
    • 1970-01-01
    • 2016-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多