Wednesday, 14 March 2018

Cognos Report Studio - To Hide column in a Crosstab

In cognos report studio to hide the column in a crosstab you have to follow a few steps.

In a list report if you select any column and set the "Box Type" Property to "None" then the column will be hidden without any problem. Whereas in crosstab if you do the same then the column will be hidden but the column headings on the right hand side of the hidden column will shift to left. To avoid this please follow the simple steps given below.

1. Open Cognos report studio and design the crosstab as per your requirement.
2. Unlock the report - Click on the lock icon on the top.
3. Click on the text which you want to hide (click only on the text not on the entire column). As shown below.

4. Cut the text.
5. Now if you run the report to check, the data will not be visible but the empty column is visible. To hide this, Select the same column and :-
  Set the border to none.
  Set Left and Right padding to 0px.


Thanks....!

Thursday, 4 August 2016

Cognos Report Studio - Horizontal Radio Button

In cognos, radio button options appear one below the other as shown below.

As you know cognos is not having any specific property to turn the vertical radio buttons into horizontal radio button, i.e radio button one beside the other (inline). To achieve this i have used javascript.

1. Go to report studio, drag a value prompt into the report.
2. Create some static choices (Use: 1, Display: Choice 1; Use: 2, Display: Choice 2)
3. Change the 'Select UI' property to 'Radio Button Group'.
Now if you run the report and check, you can see the options of the radio button one below the other.
4. Now drag a HTML item from properties window into the page and paste the below code in that.

<script type="text/javascript">
function horizontal(choices)
{
     if(choices.type == "radio")
     {
        choices.parentNode.parentNode.style.display="inline";
choices.parentNode.parentNode.style.whiteSpace="noWrap";
     }
}
function options(node)
{
for (var i = 0; i < node.childNodes.length; i++)
{
  var choices= node.childNodes[i];
  horizontal(choices);
  options(choices);
}
}
</script>

5. Now drag one HTML item just before the radio button prompt and place the below code in that,

<div id="radio">

6. Drag one more HTML item just after the radio button prompt and place the below code in that,

</div> <script>options(document.getElementById('radio'));</script>

7. Save the report and run it, now you can see the radio buttons one beside the other, as shown below.

Thanks....!