我有一个虚拟维度。 当我查询多维数据集时,结果是正确的,但当我查询虚拟多维数据集时,成员不会显示。
查询:
--From cube:
SELECT
NON EMPTY {Hierarchize({[Measures].[MyMeasure]})} ON COLUMNS,
NON EMPTY {Hierarchize({{[MyVirtualDim Usage 0.New Hierarchy 0].[All MyVirtualDim Usage 0.New Hierarchy 0s]}, {[MyVirtualDim Usage 0.New Hierarchy 0].[New Level 0].Members}, {[MyVirtualDim Usage 0.New Hierarchy 0].[curs].Members}})} ON ROWS
FROM [MyCube]
--From virtual cube:
SELECT
NON EMPTY {Hierarchize({[Measures].[MyMeasure]})} ON COLUMNS,
NON EMPTY {Hierarchize({{[MyVirtualDim.New Hierarchy 0].[All MyVirtualDim.New Hierarchy 0s]}, {[MyVirtualDim.New Hierarchy 0].[New Level 0].Members}, {[MyVirtualDim.New Hierarchy 0].[curs].Members}})} ON ROWS
FROM [MyVirtualCube]
结果:
--from cube (right)
Axis #0:
{}
Axis #1:
{[Measures].[MyMeasure]}
Axis #2:
{[MyVirtualDim Usage 0.New Hierarchy 0].[All MyVirtualDim Usage 0.New Hierarchy 0s]}
{[MyVirtualDim Usage 0.New Hierarchy 0].[1]}
{[MyVirtualDim Usage 0.New Hierarchy 0].[1].[1]}
{[MyVirtualDim Usage 0.New Hierarchy 0].[1].[2]}
Row #0: 5
Row #1: 5
Row #2: 3
Row #3: 2
--from virtual cube (bad)
Axis #0:
{}
Axis #1:
{[Measures].[MyMeasure]}
Axis #2:
{[MyVirtualDim.New Hierarchy 0].[All MyVirtualDim.New Hierarchy 0s]}
Row #0: 5
此处架构定义:
<Schema name="New Schema1">
<Dimension visible="true" name="MyVirtualDim">
<Hierarchy name="New Hierarchy 0" visible="true" hasAll="true">
<Table name="dim2" schema="public" alias="">
</Table>
<Level name="New Level 0" visible="true" table="dim2" column="id_nivell" nameColumn="id_nivell" type="Integer" internalType="int" uniqueMembers="false" levelType="Regular" caption="nivell" captionColumn="nom_nivell">
<Property name="nivell" column="nom_nivell" type="String" description="nivell">
</Property>
</Level>
<Level name="curs" visible="true" table="dim2" column="id_curs" nameColumn="id_curs" type="Integer" internalType="int" uniqueMembers="false" levelType="Regular" captionColumn="nom_curs">
<Property name="curs" column="nom_curs" type="String" description="curs">
</Property>
</Level>
</Hierarchy>
</Dimension>
<Cube name="MyCube" visible="true" cache="true" enabled="true">
<Table name="facts" schema="public">
</Table>
<DimensionUsage source="MyVirtualDim" name="MyVirtualDim Usage 0" visible="true" foreignKey="fk_dim2" >
</DimensionUsage>
<Measure name="MyMeasure" column="id" datatype="Integer" aggregator="count" visible="true">
</Measure>
</Cube>
<VirtualCube enabled="true" name="MyVirtualCube" visible="true">
<CubeUsages>
<CubeUsage cubeName="MyCube" >
</CubeUsage>
</CubeUsages>
<VirtualCubeDimension visible="true" name="MyVirtualDim">
</VirtualCubeDimension>
<VirtualCubeMeasure cubeName="MyCube" name="[Measures].[MyMeasure]" visible="true">
</VirtualCubeMeasure>
</VirtualCube>
</Schema>
有人可以看到问题所在吗?
答案 0 :(得分:2)
解决,
虚拟维度和虚拟多维数据集按预期运行。要解决我的问题,只需更改维名称即可:
<Cube name="MyCube" visible="true" cache="true" enabled="true">
<Table name="facts" schema="public">
</Table>
<DimensionUsage source="MyVirtualDim" name="MyVirtualDim Usage 0" <--here!
应该命名为:MyVirtualDim
而不是MyVirtualDim Usage 0
,因为它是多维数据集中维度的名称。