Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Grouping column value not on same line as data column
femibyte
Grouping column not on same line as data column<br />
<br />
<br />
So I have a table that looks like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>col1 col2 col3
A
X 1
X 1
B
Y 2
Y 2
C
Z 3
Z 3</pre>
<br />
The code that produces the table above is below:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>TableGroupHandle group = elementFactory.newTableGroup( );
group.setName("col1Group");
group.setKeyExpr( "dataSetRow[\"col1\"]" );
group.setInterval("none");
group.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_ASC);
group.setRepeatHeader(true);
dataTable.getGroups().add(group);
RowHandle grpHdrHandle = elementFactory.newTableRow(dataCols.size());
CellHandle tblCellHandle = (CellHandle) grpHdrHandle.getCells().get(0);
tblCellHandle.setDrop(DesignChoiceConstants.DROP_TYPE_DETAIL);
DataItemHandle data0 = elementFactory.newDataItem(null);
data0.setResultSetColumn("col1");
tblCellHandle.getContent().add(data0);
group.getHeader().add(grpHdrHandle);
RowHandle groupFooter = elementFactory.newTableRow( dataCols.size() );
String groupFooterPadding=repMetaData.getDataGroupPadding();
groupFooter.getHeight().setStringValue(groupFooterPadding);
group.getFooter().add(groupFooter);
</pre>
<br />
How do I get it to look like this instead,i.e starting on same line?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>col1 col2 col3
A X 1
X 1
B Y 2
Y 2
C Z 3
Z 3</pre>
Find more posts tagged with
Comments
mwilliams
Are you getting errors? The following line that you have should do this.
tblCellHandle.setDrop(DesignChoiceConstants.DROP_TYPE_DETAIL);
Here's the package that you must use for the DesignChoiceConstants:
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
What's your BIRT version again?
femibyte
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="107261" data-time="1342567497" data-date="17 July 2012 - 04:24 PM"><p>
Are you getting errors? The following line that you have should do this.<br />
<br />
tblCellHandle.setDrop(DesignChoiceConstants.DROP_TYPE_DETAIL);<br />
<br />
Here's the package that you must use for the DesignChoiceConstants:<br />
<br />
importPackage(Packages.org.eclipse.birt.report.model.api.elements);<br />
<br />
What's your BIRT version again?<br /></p></blockquote>
No, I'm not getting errors. However, the other non-grouping columns show up on the next line rather than on the same line as I have illustrated <br />
in the pdf.
mwilliams
What is your BIRT version?
femibyte
I'm using BIRT version 2.6 jars in Eclipse to generate the report.
mwilliams
In BIRT 2.6.1, I was able to use either:
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
ghCell.setDrop(DesignChoiceConstants.DROP_TYPE_DETAIL);
or
ghCell.setDrop("detail"); //no need to use import
And it works. This is in the beforeFactory of a report, but it should be very similar to outside the designer.
femibyte
Hmm, so what I observe occurs only in the pdf version of the report generated within Eclipse.
When I generate the report using the Web viewer the report displays properly.
mwilliams
So, it's working ok for you, where it needs to, then?
femibyte
Well, not really since the eventual format of the report will be pdf. I'll try generating outside of Eclipse and see what happens.
mwilliams
Oh. I thought you were saying it was messing up in Eclipse when in PDF, but when you deployed, it was fine. My mistake. If it runs correctly in the webviewer, is the output correct for you, if you export to PDF from the web viewer? Are you running your reports with a URL or using the REAPI? Let me know.
femibyte
When I export to pdf from the Web viewer the problem persists.
femibyte
When I export to pdf from the Web viewer the problem persists.
mwilliams
Can you attach a java file and the report you're modifying (if you're not building completely from scratch) that I can run that will show me this issue?