From 980d04202625b389f78202099146842576a8943b Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 26 Aug 2024 02:00:39 +0400 Subject: [PATCH 1/7] refactor --- .../js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index edf1d9d5f5f7..a90a73d0c307 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -670,7 +670,8 @@ const XmlaStore = Class.inherit((function () { function preparePathValue(pathValue, dataField?) { if (pathValue) { - pathValue = isString(pathValue) && pathValue.includes('&') ? pathValue : `[${pathValue}]`; + const shouldWrapPathValue = isString(pathValue) && pathValue.includes('&'); + pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { pathValue = pathValue.slice(dataField.length + 1, pathValue.length); From fdddc0061c4155c68cf7e9ea3ca09c4761b2b52a Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 26 Aug 2024 02:04:40 +0400 Subject: [PATCH 2/7] fix --- .../js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index a90a73d0c307..2c4952174c70 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -670,7 +670,9 @@ const XmlaStore = Class.inherit((function () { function preparePathValue(pathValue, dataField?) { if (pathValue) { - const shouldWrapPathValue = isString(pathValue) && pathValue.includes('&'); + const shouldWrapPathValue = isString(pathValue) && ( + pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) + ); pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { From 2bdd348750eb1b3a6af67c2988aad9158ce8b63f Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 26 Aug 2024 02:46:52 +0400 Subject: [PATCH 3/7] test --- .../store.xmla.common.tests.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/store.xmla.common.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/store.xmla.common.tests.js index dc9a6dc81baf..c1a5438f9e99 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/store.xmla.common.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/store.xmla.common.tests.js @@ -321,7 +321,28 @@ QUnit.module('Misc', stubsEnvironment, () => { assert.deepEqual(filterExpr, ['(SELECT {[Product].[Category].[Product].[Category]&}on 0']); }); + QUnit.test('T1236954. Build a correct filter query when a member has unknown member', function(assert) { + this.store.load({ + values: [{ + dataField: '[Measures].[Calculated Cost]', + }], + columns: [{ + dataField: '[Activities - Activities].[Activities]', + filterValues: ['[Activities - Activities].[Activities].[All].UNKNOWNMEMBER', + '[Activities - Activities].[Activities].&[24]', + '[Activities - Activities].[Activities].&[21]'], + }], + rows: [{ + dataField: '[Departments - Activities].[Departments]', + }], + }); + const filterExpr = this.getQuery().match(/\(select(.+?)on 0/gi); + + assert.deepEqual(filterExpr, [ + '(SELECT {[Activities - Activities].[Activities].[All].UNKNOWNMEMBER,[Activities - Activities].[Activities].&[24],[Activities - Activities].[Activities].&[21]}on 0', + ]); + }); }); QUnit.module('getDrillDownItems', stubsEnvironment, () => { From 5794b845f8aa07dd0aeb8a8db3ce7303e7ca5a03 Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 2 Sep 2024 08:30:52 +0400 Subject: [PATCH 4/7] review fix --- .../pivot_grid/xmla_store/m_xmla_store.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index 2c4952174c70..dfd32ef16b55 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -668,18 +668,20 @@ const XmlaStore = Class.inherit((function () { return cells; } - function preparePathValue(pathValue, dataField?) { - if (pathValue) { - const shouldWrapPathValue = isString(pathValue) && ( - pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) - ); - pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; - - if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { - pathValue = pathValue.slice(dataField.length + 1, pathValue.length); - } + function preparePathValue(pathValue, dataField?): string | undefined { + if (!pathValue) { + return undefined; } - return pathValue; + if (!isString(pathValue)) { + return `[${pathValue}]`; + } + + const isStartedWithDataField = dataField && pathValue.startsWith(`${dataField}.`); + const preparedPath = isStartedWithDataField + ? pathValue.slice(dataField.length + 1, pathValue.length) + : `[${pathValue}]`; + + return preparedPath; } function getItem(hash, name, member?, index?) { From 0c417eaf0d3baef3ab91c4094578dd13fa624586 Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Mon, 2 Sep 2024 08:56:38 +0400 Subject: [PATCH 5/7] Revert "review fix" This reverts commit 5794b845f8aa07dd0aeb8a8db3ce7303e7ca5a03. --- .../pivot_grid/xmla_store/m_xmla_store.ts | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index dfd32ef16b55..2c4952174c70 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -668,20 +668,18 @@ const XmlaStore = Class.inherit((function () { return cells; } - function preparePathValue(pathValue, dataField?): string | undefined { - if (!pathValue) { - return undefined; - } - if (!isString(pathValue)) { - return `[${pathValue}]`; - } - - const isStartedWithDataField = dataField && pathValue.startsWith(`${dataField}.`); - const preparedPath = isStartedWithDataField - ? pathValue.slice(dataField.length + 1, pathValue.length) - : `[${pathValue}]`; + function preparePathValue(pathValue, dataField?) { + if (pathValue) { + const shouldWrapPathValue = isString(pathValue) && ( + pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) + ); + pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; - return preparedPath; + if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { + pathValue = pathValue.slice(dataField.length + 1, pathValue.length); + } + } + return pathValue; } function getItem(hash, name, member?, index?) { From f2b9c6ab88eccada5b0f22ab58eebb77503e512d Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Wed, 4 Sep 2024 12:17:31 +0400 Subject: [PATCH 6/7] fix: naming --- .../js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index 2c4952174c70..0ee0e32a2e16 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -670,10 +670,10 @@ const XmlaStore = Class.inherit((function () { function preparePathValue(pathValue, dataField?) { if (pathValue) { - const shouldWrapPathValue = isString(pathValue) && ( + const shouldSkipWrappingPathValue = isString(pathValue) && ( pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) ); - pathValue = shouldWrapPathValue ? pathValue : `[${pathValue}]`; + pathValue = shouldSkipWrapingPathValue ? pathValue : `[${pathValue}]`; if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { pathValue = pathValue.slice(dataField.length + 1, pathValue.length); From 56d5ef1900dc61e61126a25bb4faeb7f330842f9 Mon Sep 17 00:00:00 2001 From: Roman Semenov Date: Thu, 5 Sep 2024 11:14:25 +0400 Subject: [PATCH 7/7] fix --- .../js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts index 0ee0e32a2e16..999e0ca65a36 100644 --- a/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts +++ b/packages/devextreme/js/__internal/grids/pivot_grid/xmla_store/m_xmla_store.ts @@ -673,7 +673,7 @@ const XmlaStore = Class.inherit((function () { const shouldSkipWrappingPathValue = isString(pathValue) && ( pathValue.includes('&') || pathValue.startsWith(`${dataField}.`) ); - pathValue = shouldSkipWrapingPathValue ? pathValue : `[${pathValue}]`; + pathValue = shouldSkipWrappingPathValue ? pathValue : `[${pathValue}]`; if (dataField && pathValue.indexOf(`${dataField}.`) === 0) { pathValue = pathValue.slice(dataField.length + 1, pathValue.length);