【问题标题】:Parameters. Only show in main dataset参数。仅显示在主数据集中
【发布时间】:2015-05-08 09:50:07
【问题描述】:

我有一个名为“IncomeRecievedGeneralNeeds”的主要数据集。这是主报告中使用的内容。这包括一个名为“方案”的字段

我创建了一个名为“方案”的新数据集和一个名为方案的参数,但我只希望方案参数显示主数据集中的方案。目前它显示的方案不在主数据集中.

Scheme 代码在这里 -

SELECT DISTINCT  loc.scheme AS 'Scheme'
FROM    ih_location loc

IncomeRecievedGeneralNeeds 代码在这里 -

SELECT DISTINCT  trans.tncy_sys_ref AS 'TncySysRef'
                ,ten.tenancy_ref AS 'TenancyRef'
                ,trans.created_date AS 'TransactionCreatedDate'
                ,MHS.startdate AS 'StartofWeekDate'
                ,MHS.enddate AS 'EndofWeekDate'
                ,MHS.financialyear AS 'TransactionFiscalYear'
                ,MHS.monthname AS 'TransactionFiscalMonthName'
                ,MHS.month AS 'TransactionFiscalMonth'
                ,MHS.week AS 'TransactionFiscalWeek'
                ,CONCAT('Week ',
                         MHS.week,
                        ' (',
                        CONVERT(varchar(11),MHS.startdate,103),
                        '-',
                        CONVERT(varchar(11),MHS.enddate,103),
                        ')'
                        ) AS 'TransactionFiscalWeekWithDates'
                ,trans.comment_ AS 'TransactionComment'
                ,trans.trans_amt AS 'TransactionAmount'
                ,CASE WHEN trans.account_type IN ('IN','LI') Then 'Income'
                        WHEN trans.account_type = 'HB' Then 'HousingBenefit'
                        ELSE '' END AS 'AccountType'
                ,trans.account_type
                ,ACC.description AS 'AccountCode'
                ,loc.scheme AS 'Scheme'
                ,loc.mgt_area AS 'Management Area'
                ,loc.location_type AS 'Location Type'
                ,loct.description AS 'Location Type Description'
                ,ten.tncy_start AS 'TenancyStartDate'
                ,ten.tncy_end AS 'TenancyEndDate'
                ,CASE WHEN ten.tncy_end IS NULL 
                    OR TRANS.created_date < ten.tncy_end 
                    THEN 'Current' ELSE 'Former' END AS 'IncomeTenancyStatus'
                ,ten.tncy_status AS 'TenanacyStatus'
                ,CASE WHEN ten.tncy_status = 'FOR' THEN LOC.former_arrs_ofcr ELSE loc.arrears_ofcr END AS 'OfficerCode' 


FROM    [dbo].[re_tncy_trans] trans
    INNER JOIN  
        re_tenancy ten
    ON trans.tncy_sys_ref = ten.tncy_sys_ref
    INNER JOIN
        re_tncy_place tenpl
    ON  TEN.tncy_sys_ref = tenpl.tncy_sys_ref
    INNER JOIN
        ih_location loc
    ON  tenpl.place_ref = loc.place_ref
    INNER JOIN
        [dbo].[re_accounts] acc
    ON
    trans.account_code = ACC.account_code
    AND trans.account_type = acc.account_type
    INNER JOIN
    [mhsInsight].[dbo].[mhs_month_week] mhs
    ON trans.created_date BETWEEN mhs.startdate AND MHS.enddate
    INNER JOIN
    [dbo].[ih_location_type] AS loct
    ON loc.location_type = LOCT.location_type


WHERE trans.account_type IN ('IN','HB','LI')
AND MHS.startdate >= CONVERT(DATETIME, '2014-04-07 00:00:00', 102)
and loc.place_ref <> '9999999999'

【问题讨论】:

    标签: reporting-services parameters ssrs-2012


    【解决方案1】:

    在您的参数查询中,使用您在主查询中使用的相同 FROM 和 WHERE 子句,您将只会获得与主数据集中相同的方案。

    【讨论】:

    • 我已经尝试过了 - 但我认为这就是我的报告运行缓慢的原因,因为在我选择它们之前,我的参数甚至需要很长时间才能显示出来。它确实有效,但想知道是否有更好的方法?
    • 好吧,您比我更了解您的数据库,所以也许您可以使用这些知识来消除一些连接和过滤器,这些连接和过滤器对于获得您想要的结果并不是真正需要的。您也可以尝试使用索引来提高查询的性能。但是不,没有完全不同的更好的方法。这就是这样做的方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-12
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2020-07-03
    • 1970-01-01
    相关资源
    最近更新 更多