summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2016-09-29 05:24:22 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-10-05 06:03:41 +0200
commit7e1fd9aa86ab8d5e86f35df8615f438a3383af98 (patch)
tree0e30a7ef68c0be7738659b81889b699bb0b0cbaf
parent93098854c2d2b814a21161bd88071918cb382e87 (diff)
Pivot tables: Fix wrong group field number in cache
getCache should not append new group fields to the cache, but use those which are stored in the dimension data. Change-Id: I2011b0d3a22644a86c31500d74469b9c4c641649
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx4
-rw-r--r--sc/source/core/data/dpobject.cxx3
2 files changed, 4 insertions, 3 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 63bafd2921f4..0b17d4c1a58b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2104,9 +2104,7 @@ void ScFiltersTest::testPivotTableSharedGroupXLSX()
const ScDPCache* pCache = rSheetCaches.getExistingCache(ScRange(0,0,1,13,18,1));
CPPUNIT_ASSERT_MESSAGE("Pivot cache is expected for A1:N19 on the second sheet.", pCache);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), pCache->GetFieldCount());
-
- // TODO : Look into this and find out why it fails.
- // CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pCache->GetGroupFieldCount());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pCache->GetGroupFieldCount());
xDocSh->DoClose();
}
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8e6411b96e2f..d9b07a44dc62 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2952,7 +2952,10 @@ const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
}
if (pDimData)
+ {
+ (itCache->second)->ClearGroupFields();
pDimData->WriteToCache(*itCache->second);
+ }
return itCache->second.get();
}