COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Arumugam on 08 Mar 2017 02:30:49 AM

Title: Crosstab
Post by: Arumugam on 08 Mar 2017 02:30:49 AM
I have two crosstab placed inside a table cell and column of both crosstab are dynamic(months).Problem is with their alignment.when one crosstab gets bigger,lot of white space is there for second one.Is there any way to adjust the crosstab column width dynamically to fit the table cell?
Title: Re: Crosstab
Post by: AnalyticsWithJay on 08 Mar 2017 06:58:19 AM
Since it's dynamic you'll need a dynamic calculation.

One method is to get a count of the number of months (number of columns), and divide that by the width of the container cell to get the width. You'll have to pass the number of months for each crosstab as parameters (hidden prompts).

If the container cell doesn't have a width, then max_columns * min_column_width = final_width. To calculate the width of the cells of the crosstab with less months, it's final_width / column_count.

To implement this, you'll need to use an HTML item with a source as a Report Expression.

1. Unlock the report and place an HTML item to the left of the Month member.
2. Change the source type of the HTML item to report expression.
3. Your final result in your report expression should look like this:
<div style="width: 444px;">
Of course 444px above would be the calculated result.

4. Place a second HTML item to the right of the month member with the expression:
</div>


I hope this is clear enough to get you started.
Title: Re: Crosstab
Post by: Arumugam on 08 Mar 2017 07:19:42 AM
Yes buddy.I will work on that and let you know :) :)