COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: mitch.c on 16 Dec 2011 03:47:24 PM

Title: Using conditional styles to hide rows in a crosstab
Post by: mitch.c on 16 Dec 2011 03:47:24 PM
Hello forum,

I wonder if I can impose on someone to help me with an issue I'm having.  I have a simple crosstab report that looks like this:

FIG. 1
(crosstab corner)            | count 1 | count 2
-----------------------------|---------|---------
node 1    | sub-node 1       |       10|        1
-----------------------------|---------|---------
          | sub-node 2       |       10|        0
-----------------------------|---------|---------
node 2    | sub-node 3       |        5|        5
-----------------------------|---------|---------
          | sub-node 4       |        1|        0
-----------------------------|---------|---------
          | sub-node 5       |        5|       10
-----------------------------|---------|---------
node 3    | sub-node 6       |        5|        0
-----------------------------|---------|---------
          | sub-node 7       |        1|        0
-----------------------------|---------|---------
node 4    | sub-node 8       |        2|        9
-----------------------------|---------|---------


I'm trying to suppress the rows where count 2 equals 0 by applying conditional styles to both the member fact cells (count 1 and count 2) as well as the sub-node cells.  I've been successful in hiding the member fact cells but I'm not able to hide the sub-node cells.  For illustration purposes, after applying the conditional styles, the report should look like this:

FIG. 2
(crosstab corner)            | count 1 | count 2
-----------------------------|---------|---------
node 1    | sub-node 1       |       10|        1
-----------------------------|---------|---------
node 2    | sub-node 3       |        5|        5
-----------------------------|---------|---------
          | sub-node 5       |        5|       10
-----------------------------|---------|---------
node 4    | sub-node 8       |        2|        9
-----------------------------|---------|---------


In Condition Explorer, I set up a boolean variable and used the expression [count 2] = 0 which when true, the rows will be hidden and when false (count > 0) the rows will show.  Using select ancestor, I selected Crosstab member cells and applied the condition to the Style Variable property.  I did the same thing for the Crosstab Node Member but it won't hide the node member cell.  Consequently the entire row is still visible and only the member fact cells are hidden.  Like this:

FIG. 3
(crosstab corner)            | count 1 | count 2
-----------------------------|---------|---------
node 1    | sub-node 1       |       10|        1
-----------------------------|-------------------
          | sub-node 2       |                   
-----------------------------|-------------------
node 2    | sub-node 3       |        5|        5
-----------------------------|-------------------
          | sub-node 4       |                   
-----------------------------|-------------------
          | sub-node 5       |        5|       10
-----------------------------|-------------------
node 3    | sub-node 6       |                   
-----------------------------|-------------------
          | sub-node 7       |                   
-----------------------------|-------------------
node 4    | sub-node 8       |        2|        9
-----------------------------|---------|---------



I've tried many combinations and nothing seems to be working.  I'm using Report Studio 8.4.  My real-world report is obviously much more complex but this illustrates exactly what I'm trying to accomplish.  Fig. 2 is the desired result.  Thank you in advance to anyone with suggestions.
Title: Re: Using conditional styles to hide rows in a crosstab
Post by: blom0344 on 18 Dec 2011 09:53:45 AM
Perhaps, the following filter (as opposed to using cond. formatting)

total([count1] for [item(subnode1)]  <> (total([count1] for [item(subnode1)] + total([count2] for [item(subnode2)])

as an after-autoaggregation filter