【问题标题】:Cognos Report Studio - For loop?Cognos Report Studio - For 循环?
【发布时间】:2016-01-27 17:17:46
【问题描述】:

我有一个 COGNOS 包,用于存储公司内部流程的数据。它们都有开始日期,未完成的流程没有结束日期。如果开始日期在 x 之前,而结束日期在 x 之后,或者为空,则进程在日期 x 处于活动状态。包没有时间序列。

公司需要一份报告,其中包含过去两年中每个月末的活动进程数。没有时间序列可以迭代,我必须要有创意。我创建了 24 个数据项,每个数据项的公式如下:

IF (([Start Date] <= _last_of_month(_add_months(current_date;-1))) and 
(([End Date] is missing) or 
([End Date] > _last_of_month(_add_months(current_date;-1))))) 
THEN (1) ELSE (0)

...减去 1 到 24 个月。然后,我将每个添加到报表交叉表的列中。

嗯,这个解决方案真的很丑陋,而且无法维护。有没有办法在 Report Studio 上迭代变量,为每次迭代创建一行或一列?

谢谢!

【问题讨论】:

    标签: report cognos cognos-10 cognos-bi


    【解决方案1】:

    您可以在 Report Studio 中模拟时间序列。 有一些选择:

    1. 如果您被允许在 RS 中使用 SQL。创建一个查询主题,如:

      select _last_of_month(_add_months(current_date;-1)) as Month
      union all
      select _last_of_month(_add_months(current_date;-2)) as Month
      union all
      ....
      
    2. 从带有日期的现有表中创建查询主题。查询项[月]

      _last_of_month([date_field])
      

      过滤

      [date_field] < _add_months(current_date;-24)
      

      并检查查询属性“Auto Group and Summarize”是否设置为“Yes”。 小心选择小而密集的表格作为来源。

    3. 根据任何超过 24 行的现有表创建查询主题。添加带有表达式的查询项

      1
      

      也称它为“1”。添加另一个QI,称之为[Back],表达式

      running-total([1])
      

      过滤它:

      [Back] <= 24
      

      用表达式添加另一个 QI

      _last_of_month(_add_months(current_date;-[Back]))
      

      这是您的 [月份] 字段

    比条件加入这个查询主题和你的进程列表

    [Time series].[Month] > [Process].[Start Date] and
    ([Time series].[Month] < [Process].[End Date] or [End Date] is missing)
    

    不只是计算每个 [月] 的行数

    【讨论】:

    • 抱歉回复晚了。效果很好,非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多