To Hide Null Column (Heading) in CrossTab
Hi,
I am facing a problem with cross-tab display.
Step 1)
Say My Data Table is as follows:
create table nulltest
(
XAxis varchar(10),
GroupName varchar(10),
Total int(10)
);
Containing the following Data:
Insert into nulltest(XAxis, GroupName, Total) values
('XA','A', 40 ),
('XA', 'B', 50),
('XA', 'C', 10),
('XB', 'A', 20),
('XB', 'B', 60),
('XB', 'C', 40),
('XC', NULL, NULL);
ScreenShort: Data_SS.png
2) I have to create a crosstab with XAxis (XA/XB/XC) as row-headers, GroupName as column-headers and Total as actual values in the cross tab.
So in the Report Design, I create a cross tab Grouping XAxis & GroupName, and Total as Summary Field.
3) I create a Crosstab, since The XAxis contains XC with corresponding NULL values an additional collumn with NULL is created. I here presume that BIRT cross tab does not consider NULL as a missing value, but a value by itself and hence displays it in a new collumn with header name as NULL.
Please look at the ReportOutput_SS.png screenshot attached for more info.
4) My aim is to remove/hide the column with NULL header. (P.S. The XC should be displayed in the crosstab)
In order to achieve this, I started a script with following code, but I am unable to find a way to hide this collumn. (Just coloured Yellow to spot the NULL collumn). Please help.
function onCreateCell( cellInst, reportContext )
{
if(cellInst.getCellType() == "header")
{
if(cellInst.getDataValue("GroupName") == "")
{
cellInst.getStyle().setBackgroundColor("#FFFF00");
}
}
}
File Attached: CrossTab_Script.txt