问题
I am having some trouble with an IF / CASE expression when consuming a TM1 cube in Report Studio.
I am "filtering" a crosstab with a tuple function that includes an element from the "branch" dimension. The users can navigate through this branch hierarchy by a value prompt I have made.
Hence, the users have requested that they at every time can see where they are in the branch hierarchy (i.e. see the path from root to current node).
I have therefore tried to make two query expressions which at all times represents the current node, and the current level:
[CurrentBranch]:
#prompt('pBranch', 'MUN', '[Cube].[Dimension].[Hierarchy].[Level]->:[TM].[Dim_Branch].[Dim_Branch].[@MEMBER].[49981]')#
[CurrentLevel]:
ordinal(level([CurrentBranch]))
Both of these are working as intended. However, when I try to utilize IF / CASE statements in order to display the correct amount of parents, I get all kinds of arbitrary errors. An example would be a [FirstParent] expression:
IF ([CurrentLevel] > 1) THEN
(roleValue('_memberCaption', parent([CurrentBranch])))
ELSE
('')
It produces the following error...
Data size error. The data type is 'cclDTypeExternalBuffer'.
...when [FirstParent] is added to a layout calculation.
If I change the expression to (just to test the IF statement):
IF (1 > 0) THEN
(roleValue('_memberCaption', parent([CurrentBranch])))
ELSE
('')
The same error is shown. If I then change the statement to
IF (1=0) THEN
(roleValue('_memberCaption', parent([CurrentBranch])))
ELSE
('')
or
IF (1=1) THEN
(roleValue('_memberCaption', parent([CurrentBranch])))
ELSE
('')
No error is shown, and the result is correct.
However, if I now change the expression to:
IF ([CurrentLevel]=1) THEN
(roleValue('_memberCaption', parent([CurrentBranch])))
ELSE
('')
...then the same error is show again.
Data size error. The data type is 'cclDTypeExternalBuffer'.
I have tried to wrap the [CurrentLevel] inside various common functions that are supported when working with OLAP (e.g. abs()), however, no luck there.
Any ideas why this is happening and how to fix it?
This really reaches beyond my understanding.
Thanks for ANY input!
回答1:
Found this explanation, saying that "Report expressions are designed to access parameters and report session properties; using them to access query items can be error prone." Report expression is then what I referred to as layout calcualations
http://www-01.ibm.com/support/docview.wss?uid=swg21340596
Hence, I unlocked the report and included the data items directly. This way everything was working as intended.
来源:https://stackoverflow.com/questions/20700555/ibm-cognos-report-studio-arbitrary-errors-when-using-if-case-on-an-tm1-cube