Quantcast
Channel: SCN : Discussion List - SAP BusinessObjects Analysis, edition for Microsoft Office
Viewing all articles
Browse latest Browse all 1521

Analysis Functions to determine Totals and Scaling Factor display status

$
0
0

I've been using SAPGetCellInfo via VBA to try and determine the properties of specific cells within the Crosstab. I'm using Analysis for Excel 1.4.0.2528, which I think is the pre-SP1 release of v1.4.

 

In order to distinguish between cells, I'm calling SAPGetCellInfo twice, as follows:

 

S = Application.Run("SAPGetCellInfo", rngMyCell, "SELECTION")

D = Application.Run("SAPGetCellInfo", rngMyCell, "DIMENSION")

 

By inspecting the contents of S and D, I can usually determine whether a cell is a Dimension Cell, a Member Cell or a Data Cell, and what the associated dimensions are, but things get ambiguous when the Crosstab has Totals and/or Scaling Factors displayed.....

 

The Analysis ribbon lets you set whether Totals are Shown, Hidden or Hidden when there's only 1 member, for each dimension, and whether those totals appear before or after the dimension members. However, I don't seem to be able to programtically read/write what those "Totals-Display" settings are for each dimension, and so I can't be certain if a Data Cell is a Total, other than by checking the name of the style that is applied to the cell. That is, when calling SAPGetCellInfo on a cell that is a total (of a ROW, or a COLUMN, or both), the list of dimensions that is returned by Application.Run("SAPGetCellInfo", rngMyCell, "SELECTION") doesn't include the dimensions that are being totalled.

 

For example, my Crosstab has 1 Dimension AND Measures over rows, and 2 dimensions over columns. When calling Application.Run("SAPGetCellInfo", rngMyCell, "SELECTION"), if the queried cell is:

1) A total of row dimensions, and a total of column dimensions, then ONLY the measures dimension is returned.

2) A member of a row dimension, and a total of column dimensions, then ONLY all of the row dimensions are returned

3) A total of row dimensions, and a member of the column dimension, then ONLY all of the column dimensions PLUS the measures dimension are returned

4) A member of a row dimension, and a member of a column dimension, then ALL row AND ALL column dimensions are returned

 

I suppose I could use SAPListOfDimensions to determine the ROWS and COLUMNS that should be present when I call SAPGetCellInfo on a data cell, and then assume that those missing dimensions mean that the cell is a total over the missing dimensions.... But that seems like an unreliable solution, not least because the Scaling Factor settings introduce a further complication, as per below....

 

The Analysis ribbon also lets you set whether Scaling Factors are shown for measures. However, there doesn't seem to be any way to programatically read/write what that setting is, and so I can't be certain if a cell is a Data cell total or a Scaling factor. When calling SAPGetCellInfo against a Scaling Factor cell, only the Row dimensions are returned, or in other words, the SAPGetCellInfo return value is exactly the same as a data cell that is a total over columns.

 

For example, using the same Crosstab as above, and again calling Application.Run("SAPGetCellInfo", rngMyCell, "SELECTION"), if the queried cell is:

1) A total of row dimensions, and is a Scaling Factor column, then ONLY the measures dimension is returned (same result as 1 above)

2) A member of a row dimension, and is a Scaling Factor column, then ONLY all of the row dimensions are returned (same result as 2 above)

 

Am I missing something, or is there a way I can reliably distinguish between a Scaling Factor cell, a Data Cell and a Total Data Cell, and what the actual dimensions of those cells are, even if some or all of those dimensions are totals? Is there a programmatic way to get or set the Totals display and/or Totals placement on a dimension, or the Scaling Factor display settings for a crosstab?


Viewing all articles
Browse latest Browse all 1521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>