Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,12 @@ class XmlaStore {

if (i < path.length) {
if (isLastDimensionInGroup) {
arg = `(${dataField}.${preparePathValue(path[i], dataField)})`;
const pathValue = path[i];
if (hierarchyName && isString(pathValue) && pathValue.startsWith(`${hierarchyName}.`)) {
arg = `(${pathValue})`;
} else {
arg = `(${dataField}.${preparePathValue(pathValue, dataField)})`;
}
}
} else if (i <= expandAllIndex) {
if (i === 0 && expandAllCount === 0) {
Expand Down Expand Up @@ -529,7 +534,12 @@ class XmlaStore {
|| dimension.hierarchyName !== options[headerName][index + 1]
.hierarchyName
) {
slices.push(`${dimension.dataField}.${this.preparePathValue(value, dimension.dataField)}`);
const { hierarchyName } = dimension;
if (hierarchyName && isString(value) && value.startsWith(`${hierarchyName}.`)) {
slices.push(value);
} else {
slices.push(`${dimension.dataField}.${this.preparePathValue(value, dimension.dataField)}`);
}
}
});
}
Expand Down Expand Up @@ -580,7 +590,12 @@ class XmlaStore {
if (field.hierarchyName && (fields[index + 1] || {}).hierarchyName === field.hierarchyName) {
return;
}
slice.push(`${field.dataField}.${this.preparePathValue(value, field.dataField)}`);
const { hierarchyName } = field;
if (hierarchyName && isString(value) && value.startsWith(`${hierarchyName}.`)) {
slice.push(value);
} else {
slice.push(`${field.dataField}.${this.preparePathValue(value, field.dataField)}`);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,95 @@ QUnit.module('Hierarchies', stubsEnvironment, () => {
assert.equal(query, 'with set [DX_columns] as NonEmpty({[Product].[Product Categories].[All],[Product].[Product Categories].[Category]}, {[Measures].[Customer Count]}) set [DX_rows] as NonEmpty({Descendants({[Ship Date].[Calendar].[Month].&[2003]&[8]}, [Ship Date].[Calendar].[Date], SELF_AND_BEFORE)}, {[Measures].[Customer Count]}) SELECT CrossJoin([DX_columns],{[Measures].[Customer Count]}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON columns,[DX_rows] DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON rows FROM [Adventure Works] CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS');
});

QUnit.test('T1283598. Hierarchy slice should not duplicate hierarchy prefix when path value is a full unique name', function(assert) {
this.store.load({
columns: [{ dataField: '[Active Month].[Active Month]' }],
rows: [
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Sub Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Nbr]' }
],
values: [{ dataField: '[Measures].[Members]', caption: 'Members' }],
headerName: 'rows',
path: [
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial]',
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group]'
]
});
const query = this.getQuery();

assert.notStrictEqual(
query.indexOf('WHERE ([Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group])'),
-1,
'WHERE slice contains the full unique name once'
);
assert.strictEqual(
query.indexOf('[Product].[Product Purchaser Type].[Purchaser Sub Type].[Product].[Product Purchaser Type]'),
-1,
'WHERE slice does not duplicate the hierarchy prefix'
);
});

QUnit.test('T1283598. Axis SET should not duplicate hierarchy prefix when expanded path value is a full unique name', function(assert) {
this.store.load({
columns: [{ dataField: '[Active Month].[Active Month]' }],
rows: [
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Sub Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Nbr]' }
],
values: [{ dataField: '[Measures].[Members]', caption: 'Members' }],
rowExpandedPaths: [
['[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial]'],
['[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial]', '[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group]']
]
});
const query = this.getQuery();

assert.notStrictEqual(
query.indexOf('([Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group])'),
-1,
'axis SET contains the full unique name once'
);
assert.strictEqual(
query.indexOf('[Product].[Product Purchaser Type].[Purchaser Sub Type].[Product].[Product Purchaser Type]'),
-1,
'axis SET does not duplicate the hierarchy prefix'
);
});

QUnit.test('T1283598. Drill-down WHERE slice should not duplicate hierarchy prefix when path value is a full unique name', function(assert) {
this.store.getDrillDownItems({
columns: [{ dataField: '[Active Month].[Active Month]' }],
rows: [
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Purchaser Type].[Purchaser Sub Type]', hierarchyName: '[Product].[Product Purchaser Type]' },
{ dataField: '[Product].[Product Nbr]' }
],
values: [{ dataField: '[Measures].[Members]', caption: 'Members' }]
}, {
columnPath: [],
rowPath: [
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial]',
'[Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group]'
],
dataIndex: 0,
maxRowCount: 100
});
const query = this.getQuery();

assert.notStrictEqual(
query.indexOf('WHERE ([Product].[Product Purchaser Type].[Purchaser Type].&[Commercial].&[Group])'),
-1,
'drill-down WHERE slice contains the full unique name once'
);
assert.strictEqual(
query.indexOf('[Product].[Product Purchaser Type].[Purchaser Sub Type].[Product].[Product Purchaser Type]'),
-1,
'drill-down WHERE slice does not duplicate the hierarchy prefix'
);
});

QUnit.test('Hierarchy. Expand child when opposite axis expanded on several levels', function(assert) {
this.store.load({
columns: [{
Expand Down
Loading