A bookmark is created with "Include Layout State" option to capture the current selection and current expand/ collapse layout of a pivot table. However, after reloading the document and applying the bookmark again, the pivot table does not expand correctly.
The root cause is that QlikView uses data load order to keep track of the expand/ collapse structure in pivot tables. Therefore, when the order of values in a dimension changes in the data source, the bookmark can no longer capture the correct expand/ collapse positions.
This can be demonstrated by the following example:
1. Download the attached example QlikView document
2. Apply the document bookmark BM1, the pivot table should be expanded as follows (B is collapsed, A and C are expanded)
3. Go to the Script editor. Comment out Part1, uncomment Part2 and reload the document. Part1 and Part2 loads the same data, but the load order for field DIM1 is A-B-C in Part1 and A-C-B in Part2
4. Apply the same bookmark again. Observe that the pivot table is expanded differently now (C is collapsed, A and B are expanded)
5. Export bookmark BM1 (Bookmarks > Export). Open the resulting XML file, look for entry
<ExpansionInfo>. The following sub-tags should be found under this entries:
which means that the 0th and 2nd values of field
DIM1 by load order will be expanded in the pivot table. When the load order of
DIM1 is A-B-C, then A and C will be expanded. Similarly, A and B will be expanded if the load order is A-C-B
In order to retain the pivot table layout, make sure the dimension values do not change their orders in the data source when the document is reloaded.