SSRS报告错误-.tvf函数指定了太多参数

时间:2018-08-11 02:11:04

标签: sql reporting-services parameters ssrs-tablix table-valued-parameters

我正在通过将旧参数更改为新参数来更新现有代码:

      @RegionsWHID -  updated with @GLProgramGroupsWHID
      @ProgramsWHID - updated with @GLProgramsWHID  

      and added one more - @GLProgramGroupSetsWHID.

在以前的更新中(在其他代码上-没有表值函数)-一切正常。 但是在SSRS报告中,此代码出现以下错误: enter image description here

我的代码在sql(SSMS)中工作正常,但仅在SSRS中显示错误 这是代码:

   USE WH

      DECLARE @FYMonthBOP date = '07-01-2017'
      DECLARE @FYMonthEOP date = '03-31-2018'
      DECLARE @GLProgramGroupSetsWHID int = -1
      DECLARE @GLProgramGroupsWHID int = -1
      DECLARE @GLProgramsWHID_Groups int = -1

     SELECT        
            trans.GLGroupLevel0Name
          , trans.GLGroupLevel0Ordinal AS Ordinal0
          , trans.GLGroupLevel1Name
          , trans.GLGroupLevel1Ordinal AS Ordinal1
          , trans.GLGroupLevel2Name
          , trans.GLGroupLevel2Ordinal AS Ordinal2
          , trans.GLAccountCode
          , trans.GLAccountName
      --  , trans.Region
          , trans.GroupName
          , trans.GroupNameWHID
          , trans.OrdinalGroupName 
          , trans.GLProgramCode + N' ' + trans.GLProgramName AS Program
          , trans.FYQuarterLabel AS FQ
          , trans.AmountActual AS AmountActual
          , trans.AmountBudget
      --  , trans.[GLRegionFK] AS WHIDRegion
      --  , trans.RegionOrdinal AS OrdinalRegion
          , trans.GroupSetName
          , trans.GroupSetNameWHID
          , trans.[GLProgramFK] AS WHIDProgram
          , trans.ProgramOrdinal AS OrdinalProgram
          , trans.FYMonthNumber
          , trans.FYMonthShortLabel
          , trans.FYQuarterNumber
          , trans.FYNumber
          , trans.FYLabel
          , trans.YearMonthSort
          , IIF(EOMonth(mm.DateThru) < @FYMonthEOP, 
                EOMonth(mm.DateThru), @FYMonthEOP) AS [DateThru]

     FROM            
           [Reports].[tvfGLTransMonthlyActualBudget] 
            (@FYMonthBOP, @FYMonthEOP, @GLProgramGroupSetsWHID, 
             @GLProgramGroupsWHID, @GLProgramsWHID_Groups, 'Original') trans

      CROSS APPLY (
                    SELECT MAX(t.EffectiveMonth) AS [DateThru] 
                    FROM [Fact].[GLTransactionsMonthly] t WITH (NoLock) 
                  ) mm

      WHERE (
               (NOT (trans.[GLAccountCode] IN (N'9040',N'9047',N'4130'))) 

                AND (
                    (trans.[GLProgramFK] IN (
                           SELECT DISTINCT 
                                          f.[GLProgramFK]

                            FROM            
                                 [Fact].[GLTransactionsMonthly] f
                              INNER JOIN [Dimension].[GLAccount] a 
                                      ON f.GLAccountFK = a.[WHID]

                                   WHERE 
                                       (f.EffectiveMonth BETWEEN @FYMonthBOP 
                                                            AND @FYMonthEOP)
                                   AND (a.[GLAccountCode] BETWEEN '5000' 
                                                                 AND '9999')

                                   GROUP BY
                                         f.[GLProgramFK]

                                         HAVING 
                                               (SUM(f.[Amount]) <> 0.0)
                                                                      ))
                                             OR
                                               (trans.[GLProgramFK] IN (
                                                  SELECT DISTINCT
                                                        f.[GLProgramFK]

                                                   FROM            
        [Fact].[GLTransactionsMonthly] f
        INNER JOIN [Dimension].[GLAccount] a ON f.GLAccountFK = a.[WHID]

    WHERE 
        (f.EffectiveMonth BETWEEN @FYMonthBOP AND @FYMonthEOP)
        AND (a.[GLAccountCode] BETWEEN '4000' AND '4999')

    GROUP BY
         f.[GLProgramFK]

    HAVING 
        (SUM(f.[Amount]) <> 0.0)
    ))
OR 
    (trans.[GLProgramCode] IN ('549'))
)   

错误涉及到函数-第1次FROM之后-   [报告]。[tvfGLTransMonthlyActualBudget] 此功能之后的其他所有内容均保持不变,无需更改

这是我在SSMS中的表值函数:

enter image description here

最后一个参数@BudgetVersion(蓝色圆圈)不在我的SSRS参数中。

这可能是错误的原因吗?

但是,如果-是,-此报表如何使用旧参数-@RegionsWHID和ProgramsWHID?在该版本中-SSRS也没有@BudgetVersion参数...

任何建议或意见-都会有很大帮助!

谢谢

0 个答案:

没有答案