0

I'm using Mondrian as the Olap Server to my application written in Java.

So, I have a XML schema with a couple of Cubes.

<mon:Schema name="TechServiceDataCtrl" ...... >
...
...
...
<Cube name="ExclusiveUseEquipmentCtrl" defaultMeasure="ObjectCount">
    <Table name="DATA_CTRL_EU$EU" schema="TS_DATA_CTRL" />

    <DimensionUsage name="Region" source="Region" caption="Region" foreignKey="REGION_ID" />

    <Dimension name="EquipmentType" caption="EquipmentType" foreignKey="EQUIPMENT_TYPE">
        <Hierarchy primaryKey="EQUIPMENT_TYPE" hasAll="false"  caption="EQUIPMENT_TYPE">
            <Table name="DATA_CTRL_EU$EU" schema="TS_DATA_CTRL" />

            <Level name="EquipmentType" column="EQUIPMENT_TYPE"  table="DATA_CTRL_EU$EU"
                approxRowCount="10" caption="EQUIPMENT_TYPE" type="String">
            </Level>
        </Hierarchy>
    </Dimension>

    <Dimension name="EquipmentTypeGroup" caption="EquipmentTypeGroup" foreignKey="TYPE_GROUP">
        <Hierarchy primaryKey="TYPE_GROUP" caption="TYPE_GROUP" hasAll="false">
            <Table name="DATA_CTRL_EU$EU" schema="TS_DATA_CTRL" />

            <Level name="EquipmentTypeGroup" column="TYPE_GROUP" table="DATA_CTRL_EU$EU"
                approxRowCount="2" caption="EquipmentTypeGroup" type="String" />
        </Hierarchy>
    </Dimension>

    <Measure name="ObjectCount" column="COUNT" aggregator="sum" caption="ObjectCount"
        formatString="####0">
        <Annotations>
            <Annotation name="drillThroughHandlerClass">ru.argustelecom.techservice.networksummary.datactrl.drillthrough.ExclusiveUseEquipmentDrillThroughHandler</Annotation>
            <Annotation name="factKey">REGION_ID</Annotation>
        </Annotations>
    </Measure>
</Cube>
</mon:Schema>


Also I have a XML describing report forms for these Cubes. According XML text:

<ns:group name="ReportModule" catalogName="olap/TechServiceDataCtrl">
...
...
...
<ns:group name="ClientEquipment" securityRole="TechServiceDataCtrl_ClientEquipment">
    <ns:summaryReport title="report title">
        <olapQuery objectName="title" dwhSolutionName="DATA_CTRL_AF">
            <mdx><![CDATA[
                    SELECT
                        {[Measures].[ObjectCount]}
                    ON COLUMNS,
                        NonEmptyCrossJoin (
                            Parameter("REGION_TREE", [Region], { [Region].DefaultMember }),
                            CrossJoin (
                                [EquipmentTypeGroup].Members,
                                [EquipmentType].Members
                            )
                        )
                    ON ROWS
                    FROM [ExclusiveUseEquipmentCtrl]
                   ]]></mdx>
        </olapQuery>
    </ns:summaryReport>
</ns:group>
</ns:group>


And in this case, in ObjectCount, when we expand Regions, we can have empty cells, if there is no data in some groups.

EmptyCells


I wanted to set Zeroes instead of empty cells, and wrote a CalculatedMember "ObjectCount" (and renamed an existing Measure to "ObjCount")

    <CalculatedMember name="ObjectCount" dimension="Measures" caption="ObjectCountCalc" formatString="####0">
        <Formula>
            IIf([Measures].[ObjCount] = 0 OR ISEMPTY([Measures].[ObjCount]),0,[Measures].[ObjCount])
        </Formula>
        <!--<CalculatedMemberProperty name="FORMAT_STRING" value="####0"/>-->
    </CalculatedMember>


But there became a problem: my every value became non-clickable (lost DrillThrough action because of making value-column calculated).

How can I solve this problem?

I tried to create members with COALESCEEMPTY() check in olapQuery but no result...

Or maybe I can write Zeroes in cells any other way, without adding a CalculatedMember?

Thanks!

Maxi-Hard
  • 89
  • 4

1 Answers1

0

I know this is old, but I think what you're looking for is using a MemberFormatter. You can inline the code as Javascript so it's easy enough.

<MemberFormatter>
   <Script language="JavaScript">
       return member.isNull() ? 0 : member.getName();
   </Script>
</MemberFormatter>

That keeps it as a normal Measure and drillthrough is kept intact.

chubbsondubs
  • 37,646
  • 24
  • 106
  • 138