如何存储Pentaho用户控制台分析月份数值而不是月份名称值

时间:2015-05-20 08:27:25

标签: filter pentaho mondrian

是否有可能在保存的分析过滤器中以某种方式存储列号而非列名?我的Pentaho用户控制台版本是5.3。这是我在mondrian中的级别元素:

数据库中的存储值:

month_name 中的值为:[Jan,Feb,Mar,Apr,...] month_number 中的值为:[1,2,3,..]

<Level name="month" visible="true" column="month_number" ordinalColumn="month_number" nameColumn="month_name" type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never" caption="%{polymis.dimension.timedimension.hierarchy.level.month.caption}">
        <Annotations>
          <Annotation name="AnalyzerDateFormat">
            <![CDATA[[yyyy].['Q'q].[MMM]]]>
          </Annotation>
        </Annotations>
      </Level>

上面你可以看到我使用 column =“month_number”所以我认为下面的分析文件中存储的值就像过滤后的值一样,而是来自的值“month_name”,对我来说这是无效的,因为我使用了几个月的本地化值,所以当我将我的语言转换为另一个时,这对我来说不适用于Pentaho用户控制台。 存储的值应该是

<filters>
        <filter formula="[timedimension].[month_name]" viewFilterEnum="MULTIPLE">
            <predicates>
                <predicate ordinal="1" operatorEnum="EQUAL">
                    <member formula="[timedimension].[2010].[Q1].[Mar]" caption="Mar" pos="0"/>
                </predicate>
            </predicates>
        </filter>
    </filters>

结果应如下所示

<member formula="[timedimension].[2010].[Q1].[3]" caption="Mar"
     pos="0"/>

1 个答案:

答案 0 :(得分:0)

你有一个属性

nameColumn="month_name"

您应该使用month_number作为name属性。由于它与column属性相同,您只需将其删除即可。

AnalyzerDateFormat注释也需要更改,从[yyyy].['Q'q].[MMM][yyyy].['Q'q].[M]