Row headers for details section columns

Post Author: Shawn Weaver
CA Forum: General
I'm new to Crystal Reports, and I'm recreating some old reports in Crystal. I'm currently working on a report that shows record detail in columns, with a header for each row at the start of the row (on the left).
I've figured out how to use the "Format with multiple columns" option to display the records in columns, but I can't figure out a way to put headers in the first column.
For example, if the fields being displayed were an ID, date, and price, I'm trying to do something similar to:
ID        <ID1>        <ID2>        <ID3>
Date    <Date1>    <Date2>    <Date3>
Price    <Price1>    <Price2>    <Price3>
I don't know if a Cross-Tab would provide a better solution, but I would need some guidance on that, as well, since my attempts at using a Cross-Tab so far haven't had much success.
Thanks for any help.

Post Author: Shawn Weaver
CA Forum: General
This thread hasn't seen any updates, but I've figured out a few different ways to solve my problem, so I'm going to add them here for anyone that may come along in the future.
The first method is to put headers in the first column and use conditional formatting to prevent the headers from being shown on any column except the first. This achieves the row header effect but limits the usable room in the column (since part of it will be taken for the headers, even if they're not displayed).
The second (and, in my opinion, better) method is to simply use groups. For each group, the group header and footer will be put around the column:
<Group Header> <Column> <Group Footer>
If the group footer is suppressed, and the group header is suppressed using conditional formatting (like above), you get a header followed by several columns. The only difference is that the conditional formatting must be applied to the group rather than the detail record.
In both cases, the conditional formatting is simple (Crystal Script):
RecordNumber mod <columns> <> 1
(for groups: "GroupNumber mod <columns> <> 1")
where "<columns>" is the number of columns displayed on a page. (i.e., "GroupNumber mod 4 <> 1" for a report with 4 detail columns)

Similar Messages

  • Repeated Header Row within a Details Section Only of a Group Ignores Tablix Member Properties

    Ok.  I have a situation where I have a details section of a group, and I am trying to get it to repeat the row headers on each page.  It's not working.  I've gone into Advanced Mode, and addressed the static Tablix Member for the left-most
    field of the header row in question, set the properties for the Tablix Member to "RepeatOnNewPage:  True" and "KeepWithGroup: After", and still, it refuses to repeat the row header for these details.  I've tried rebuilding and
    not deleting the column where the grouping was originally assigned (without deleting the grouping, of course), and assigned the properties for "RepeatOnNewPage" to that left-most, grouping field, yet I get the exact same results.  I've looked
    up solutions, and even spoken to the expert of experts, but no joy here.  I'm using VS'10.

    OK.  So it is fixed... sort of...
    Apparently, you must select to add group headers repeated as you create the group (inc. child group), BESIDES changing in Advanced Mode, Tablix Member /Properties / etc.   Then you have to format that extra column within your Tablix to
    make it appear to 'disappear'.  BUT EVEN THEN, there is a new problem:
    The headers will repeat on the additional pages, but only to a point.  For some odd reason, SSRS doesn't consistently render the repeated headers of the group details for
    every page, just where it is a hard (page) break, as opposed to a soft (page) break.  My gut tells me that this has nothing to do with the .xml code, but is an SSRS idiosyncrasy. 

  • Set Range Start for Detail Section of advanced table

    Hi All
    I have the following requirement :
    My page is a search page and the results region has a master-detail section which is implemented using a view link. Now in the detail section, there is an icon on which a PPR has been implemented and it navigates to a new page. Once we come back to this page, we are not retaining the AM due to some technical reasons.
    Now when the page is displayed, we are re-querying and showing the results to the user. Before navigation, we are storing rangestart for the master section in a session variable and are able to assign it back.
    Problem :
    If the detail section has about 50 rows and the user has navigated to the 30th row using the naviagtion bar of the detail section, how do we assign it back for each master row once we come back to this screen?
    Regards
    Sriram

    What is the source of your import? If your camera is attached, or if you copied s camera's card to your Mac or if you  made a camera archive, Final Cut will see the file as a camera and you should be able to make elections in the import preview window - by using keyboard shortcuts, or the Range tool.,
    Russ

  • Vertically align a field in details section.

    I am new to Crystal Reports so I will do my best to explain what I am trying to achieve......
    In MS Excel, it is possible to vertically align text so that it remains in the centre of the cell regardless of the cell height. I would like to do a similar thing in the details section of Crystal Reports.
    I have several fields in the details section of the report. They are all in a horizontal line. I have enabled the 'Can Grow' feature for one of the fields so that it will increase in height to accomodate large text entries. I would like the other fields to adjust so that the centres of each of the fields align vertically - in the same way as they would in excel is the text was aligned vertically.
    Any advise would be greatly appreciated.

    I do not want to horizontally align the writing.
    I have 5 fields in a row in the details section. One of the fields (call it field A) can grow to usually no more than 2 lines.
    When field A takes up 1 line then the other fields look OK becuase the centres of all of the fields line up.
    When field A grows to 2 lines, I would like writing in the other fields to move down slightly so that they align with the centre of field A.
    Is this possible?

  • Datagrid row headers

    Is there a way to create row headers for flex datagrid instead of column header?

    No, not really.  You can lock the first column so it won't scroll
    horizontally

  • Displaying Multiple Row Header for Matrix...

    Hi
           Can you please tell me, whether we can display Multiple row headers for the Matrix object same as that in the Posting Period SAP Form...
    Please check the Link: http://img198.imageshack.us/img198/3491/postingperiodform.jpg..
    Thanking you in advance...
    Thanks
    Hari

    I am extremly sorry...Please check the following link...
    Link Address : http://www.freeimagehosting.net/image.php?d499726589.jpg
    Edited by: hari angamaly on Jun 17, 2009 1:20 PM
    Edited by: hari angamaly on Jun 17, 2009 1:21 PM

  • Trying to add/update detail section VO throws ArrayIndexOutofBounds excepti

    I am getting the following exception while trying to save/update the rows in the detail section. This error is coming from ADF framework and not able to debug. I am using ADF 11g. Please help me on resolving this.
    -Gopal
    Sep 17, 2009 3:44:11 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: ADF: Adding the following JSF error message: Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.ArrayIndexOutOfBoundsException, msg=0
         at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:375)
         at oracle.adf.model.binding.DCBindingContainer.reportException(DCBindingContainer.java:437)
         at oracle.adf.model.binding.DCControlBinding.reportException(DCControlBinding.java:202)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.setAttributeFromValueList(JUCtrlListBinding.java:2505)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.setSelectedIndex(JUCtrlListBinding.java:1624)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.setInputValueInRow(JUCtrlListBinding.java:3077)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2755)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2718)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.setInputValue(FacesCtrlListBinding.java:179)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.put(JUCtrlValueBinding.java:2387)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.put(JUCtrlListBinding.java:2998)
         at javax.el.MapELResolver.setValue(MapELResolver.java:229)
         at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:283)
         at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:100)
         at com.sun.el.parser.AstValue.setValue(AstValue.java:140)
         at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:255)
         at org.apache.myfaces.trinidad.component.UIXEditableValue.updateModel(UIXEditableValue.java:289)
         at org.apache.myfaces.trinidad.component.UIXEditableValue.processUpdates(UIXEditableValue.java:252)
         at org.apache.myfaces.trinidad.component.ChildLoop$Update.process(ChildLoop.java:76)
         at org.apache.myfaces.trinidad.component.ChildLoop.runAlways(ChildLoop.java:55)
         at org.apache.myfaces.trinidad.component.ChildLoop.runAlways(ChildLoop.java:48)
         at org.apache.myfaces.trinidad.component.UIXColumn.processUpdates(UIXColumn.java:111)
         at oracle.adf.view.rich.component.rich.data.RichColumn.processUpdates(RichColumn.java:262)
         at org.apache.myfaces.trinidad.component.UIXCollection.processComponent(UIXCollection.java:954)
         at org.apache.myfaces.trinidad.component.TableUtils$3.process(TableUtils.java:283)
         at org.apache.myfaces.trinidad.component.ChildLoop.runAlways(ChildLoop.java:55)
         at org.apache.myfaces.trinidad.component.ChildLoop.runAlways(ChildLoop.java:48)
         at org.apache.myfaces.trinidad.component.TableUtils.__processStampedChildren(TableUtils.java:278)
         at org.apache.myfaces.trinidad.component.UIXTable._processStamps(UIXTable.java:518)
         at org.apache.myfaces.trinidad.component.UIXTable.processFacetsAndChildren(UIXTable.java:374)
         at org.apache.myfaces.trinidad.component.UIXCollection.updateChildrenImpl(UIXCollection.java:208)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1045)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:829)
         at org.apache.myfaces.trinidad.component.UIXTable.processUpdates(UIXTable.java:158)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1055)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1045)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:829)
         at org.apache.myfaces.trinidad.component.UIXShowDetail.processUpdates(UIXShowDetail.java:115)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1055)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1045)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:829)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1055)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1045)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:829)
         at oracle.adf.view.rich.component.rich.layout.RichPanelBox.processUpdates(RichPanelBox.java:226)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1055)
         at oracle.adf.view.rich.component.fragment.UIXRegion.updateChildrenImpl(UIXRegion.java:573)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1045)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:829)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$UpdateModelValuesCallback.invokeContextCallback(LifecycleImpl.java:1192)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1340)
         at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:529)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1312)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1406)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1312)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1406)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1312)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1406)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1312)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1406)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1312)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1406)
         at oracle.adf.view.rich.component.rich.RichDocument.invokeOnComponent(RichDocument.java:159)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:675)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:301)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    Hi,
    the stack trace does not help solving the problem. You will have to provide information on the implementation
    Frank

  • Showing headers based on multi column details section

    Hi,
    I have a report which has a subreport listing a simple list of records from a table.
    The list of records is displayed using the "Format with Multiple Columns" option in Section Expert (2 columns). The printing direction is set to "Down then Across".
    How can I set up the report so that it suppresses the header for the 2nd column is there if no data there?
    Thanks

    Hi Santhosh,
    I used formulas in a similar concept to what Abhilash mentioned above (*you will need to know how many rows fit on one page).
    Create a formula to put in the details section (where your headers are) that keeps a track of the page, column and row number (which resets the variables accordingly)..
    shared numbervar rowCount;
    shared numbervar pageNum;
    shared numbervar columnNum;
    if pageNum <> pagenumber then (
    // now a new page so reset everything..
        rowCount := 0;
        columnNum := 1;
        pageNum := pagenumber;
    if rowCount = 30 then (
    // new column so reset the row counter
        rowCount := 0;
        columnNum := columnNum + 1;
    rowcount := rowcount + 1;
    ..now use the rowCount variable to suppress the details header if its > 1.

  • Crystal reports show rows of a field in detail section in number of columns while exporting in ms excel

    Hi,
    I have a crystal report and a field called source.
    The source field can contain more than one records.
    When I export it to ms excel then source field is shown in three rows in excel.
    Name
    Source
    Batch No
    ABC
    A0001
    K1
    K2
    K3
    But now I want to export to excel in the following format
    Name
    Source
    Batch No
    ABC
    A0001
    K1
    K2
    K3
    The Name and Batch No field are in Group Header and Source in detail section.
    Also the Source field can vary in number i.e. there can be any number of Source.
    And I only want this type of output when exporting to MS Excel.
    Is there any way to do this?
    Please reply.
    Thanks.

    Try this:
    1) Create a formula with this code and place it on the Details Section:
    whileprintingrecords;
    numbervar x := x + 1;
    stringvar col1;
    stringvar col2;
    stringvar col3;
    if x = 1 then col1 = {Source}
    else if x = 2 then col2 = {Source}
    else if x = 3 then col3 = {Source};
    2) Create another formula and place this on the Group Header:
    whileprintingrecords;
    numbervar x := 0;
    stringvar col1 := "";
    stringvar col2 := "";
    stringvar col3 := "";
    3) Create three separate formulae - one each for the three Source columns and place these on the Group Footer:
    E.g. for first Source column:
    whileprintingrecords;
    stringvar col1;
    E.g. for second Source column:
    whileprintingrecords;
    stringvar col2;
    Drag and drop these formulae beside each other on the GF.
    4) Move the 'Name' and 'Batch No.' fields from the Group Header to the Group Footer
    5) Suppress Group Header and the Details Section.
    -Abhilash

  • Display column headers to display on detail section only

    Post Author: Docmidnite
    CA Forum: General Feedback
    I am using Crystal 9.0.
    I am creating reports with 3-5 group drill downs.
    The user only wants the column headers to be seen when they display the detail section.
    any ideas?

    Post Author: krishna.moorthi
    CA Forum: General Feedback
    write suppress condition for headers Like
    DrillDownGroupLevel<>drilldowngroupnumber(Ex : 3 or 4 or 5)

  • Master Detail Form - Update Statement for Column in the Detail Section

    Hello,
    I've posted a demo application to apex.oracle.com
    Application# 49298
    Application Name: Street_Inventory
    Basically, on page 3 I have a Master Detail Form. In the Detail section, I want the value of On_hand to save to table ITEMS. Here's my code below.
    SOURCE
    select
    "CONSUME_DETAIL"."CONSUME_DETAIL_ID",
    "CONSUME_DETAIL"."CONSUME_HEADER_ID",
    "CONSUME_DETAIL"."ITEM_ID",
    "CONSUME_DETAIL"."CONSUMED_QUANTITY",
    ("ITEMS"."ON_HAND" - "CONSUME_DETAIL"."CONSUMED_QUANTITY") as "ON_HAND"
    from "CONSUME_DETAIL",
    "ITEMS"
    where "CONSUME_HEADER_ID" = :P3_CONSUME_HEADER_ID
    and "CONSUME_DETAIL"."ITEM_ID"="ITEMS"."ITEM_ID"
    UPDATE INVENTORY PROCESS
    UPDATE ITEMS
    SET ON_HAND = :P3_ON_HAND - :P3_CONSUMED_QUANTITY
    WHERE ITEM_ID = (select     ITEM_ID
    from     CONSUME_DETAIL
    where CONSUME_DETAIL_ID = :P3_CONSUME_DETAIL_ID);
    My code isn't working. What am I doing wrong?

    WReed,
    The first thing I see "off the bat" is that you don't have items named P3_ON_HAND and P3_CONSUMED_QUANTITY which are referenced in your code. Although it's possible to do what you want with just SQL, I updated your code with a little PL/SQL to make it easier to understand...
    As you'll see the problem now is that the design/db model is not quite right as your getting a too many rows error.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

  • My final version of a table with row headers and column footers

    This version is superior to the one I posted yesterday
    as it is better designed and responds to changes in
    size correctly. You can also have a header/footer with
    multiple columns/rows.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableColumnModel;
    import java.awt.*;
    import java.awt.event.AdjustmentListener;
    import java.awt.event.AdjustmentEvent;
    import java.awt.event.ComponentListener;
    import java.awt.event.ComponentEvent;
    public class HeaderFooterTablePanel extends JPanel {
        static abstract class AbstractHeaderFooterTableModel extends AbstractTableModel {
            public abstract int getRowHeaderColumnCount();
            public abstract Object getRowHeaderValueAt(int rowIndex,
                                                       int columnIndex);
            public abstract int getFooterRowCount();
            public abstract Object getFooterValueAt(int rowIndex,
                                                    int columnIndex);
        static class RowHeaderTableModel extends AbstractTableModel {
            private AbstractHeaderFooterTableModel abstractHeaderFooterTableModel;
            public RowHeaderTableModel(AbstractHeaderFooterTableModel abstractHeaderFooterTableModel) {
                super();
                this.abstractHeaderFooterTableModel = abstractHeaderFooterTableModel;
            public String getColumnName(int column) {
                return "";
            public int getColumnCount() {
                return abstractHeaderFooterTableModel.getRowHeaderColumnCount();
            public int getRowCount() {
                return abstractHeaderFooterTableModel.getRowCount();
            public Object getValueAt(int rowIndex, int columnIndex) {
                return abstractHeaderFooterTableModel.getRowHeaderValueAt(rowIndex, columnIndex);
        static class ColumnFooterTableModel extends AbstractTableModel {
            private AbstractHeaderFooterTableModel abstractHeaderFooterTableModel;
            public ColumnFooterTableModel(AbstractHeaderFooterTableModel abstractHeaderFooterTableModel) {
                super();
                this.abstractHeaderFooterTableModel = abstractHeaderFooterTableModel;
            public String getColumnName(int column) {
                return "";
            public int getColumnCount() {
                return abstractHeaderFooterTableModel.getColumnCount();
            public int getRowCount() {
                return abstractHeaderFooterTableModel.getFooterRowCount();
            public Object getValueAt(int rowIndex, int columnIndex) {
                return abstractHeaderFooterTableModel.getFooterValueAt(rowIndex, columnIndex);
        static class SyncColumnWidths implements TableColumnModelListener {
            private final JTable centerTable;
            private final JTable footerTable;
            public SyncColumnWidths(JTable centerTable,
                                    JTable footerTable) {
                this.centerTable = centerTable;
                this.footerTable = footerTable;
            // Change the column widths of the footer table when the column widths
            // of the center table change.
            public void columnMarginChanged(ChangeEvent e) {
                TableColumnModel centerTableColumnModel = centerTable.getColumnModel();
                TableColumnModel footerTableColumnModel = footerTable.getColumnModel();
                for (int i = 0; i < centerTableColumnModel.getColumnCount(); i++) {
                    int width = centerTableColumnModel.getColumn(i).getPreferredWidth();
                    footerTableColumnModel.getColumn(i).setPreferredWidth(width);
            public void columnSelectionChanged(ListSelectionEvent e) {
            public void columnAdded(TableColumnModelEvent e) {
            public void columnMoved(TableColumnModelEvent e) {
            public void columnRemoved(TableColumnModelEvent e) {
        private JTable centerTable;
        private JTable rowHeaderTable;
        private JTable columnFooterTable;
        public HeaderFooterTablePanel(AbstractHeaderFooterTableModel abstractHeaderFooterTableModel) {
            super();
            // Create the center, rowHeader and columnFooter tables
            centerTable = new JTable(abstractHeaderFooterTableModel);
            rowHeaderTable = new JTable(new RowHeaderTableModel(abstractHeaderFooterTableModel));
            columnFooterTable = new JTable(new ColumnFooterTableModel(abstractHeaderFooterTableModel));
            // Disabled column re-ordering
            centerTable.getTableHeader().setReorderingAllowed(false);
            columnFooterTable.getTableHeader().setReorderingAllowed(false);
            // We are using scroll panes, so no auto resizing of table.
            centerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            columnFooterTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            // Only allow the user to change the column widths from the center table, not the
            // columnFooter.
            columnFooterTable.getTableHeader().setResizingAllowed(false);
            // When the center table column widths change, change those in the columnFooter table.
            SyncColumnWidths syncColumnWidths = new SyncColumnWidths(centerTable, columnFooterTable);
            centerTable.getColumnModel().addColumnModelListener(syncColumnWidths);
            // Set the width of the row header before adding it to the center scroll pane
            // as the row header.
            Dimension rowHeaderSize = rowHeaderTable.getPreferredScrollableViewportSize();
            rowHeaderSize.width = rowHeaderTable.getPreferredSize().width;
            rowHeaderTable.setPreferredScrollableViewportSize(rowHeaderSize);
            rowHeaderTable.setRowHeight(centerTable.getRowHeight());
            // Create the center scroll pane and set the row header table as the row header.
            final JScrollPane centerScrollPane = new JScrollPane(centerTable);
            centerScrollPane.setRowHeaderView(rowHeaderTable);
            // We will handle horizontal scrolling with our own scrollbar.
            centerScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            // Now we create the panel to hold the columnFooter table and the horizontal
            // scrollbar.
            final JPanel columnFooterPanel = new JPanel(new BorderLayout());
            // Keep the space below the row header empty.
            Component westGlue = Box.createHorizontalStrut(rowHeaderSize.width);
            // Set height of the columnFooterTable before adding it to the columnFooter scroll pane
            // as the view.
            Dimension columnFooterSize = columnFooterTable.getPreferredScrollableViewportSize();
            columnFooterSize.height = columnFooterTable.getPreferredSize().height;
            columnFooterTable.setPreferredScrollableViewportSize(columnFooterSize);
            columnFooterTable.setRowHeight(centerTable.getRowHeight());
            // The scroll pane which holds the columnFooterTable.
            final JScrollPane columnFooterScrollPane = new JScrollPane(columnFooterTable);
            // We do our own horizontal scrolling and the columnFooterScrollPane never scrolls vertically.
            columnFooterScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            columnFooterScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
            // The scrollbar we use to scroll horizontally.
            final JScrollBar horizontalScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
            // Sync up all the scrolling. See the method for details.
            syncScrolling(centerScrollPane, horizontalScrollBar, columnFooterScrollPane);
            // Keep the space below the vertical scrollbar empty.
            final JScrollBar verticalScrollBar = centerScrollPane.getVerticalScrollBar();
            int verticalScrollBarWidth = verticalScrollBar.getPreferredSize().width;
            final Component eastGlue = Box.createHorizontalStrut(verticalScrollBarWidth);
            // Set the center viewport size to match to table size
            Dimension centerTablePreferredsize = centerTable.getPreferredSize();
            centerTable.setPreferredScrollableViewportSize(centerTablePreferredsize);
            centerScrollPane.getViewport().setSize(centerTablePreferredsize);
            // The panel that holds the columnFooterTable and the horizontal scrollbar below it.
            final JPanel footerPanel = new JPanel(new BorderLayout());
            footerPanel.add("North", columnFooterScrollPane);
            footerPanel.add("South", horizontalScrollBar);
            footerPanel.setMinimumSize(footerPanel.getPreferredSize());
            // Assemble our columnFooterPanel.
            columnFooterPanel.add("West", westGlue);
            columnFooterPanel.add("Center", footerPanel);
            columnFooterPanel.add("East", eastGlue);
            // This keeps the columnFooterPanel at its minimum height
            JPanel northPanel = new JPanel(new BorderLayout());
            northPanel.add("North", columnFooterPanel);
            // Assemble the center scroll pane, below it the panel containing the column
            // footer panel, and then vertical glue to eat up any available vertical space.
            Box box = Box.createVerticalBox();
            box.add(centerScrollPane);
            box.add(northPanel);
            box.add(Box.createVerticalGlue());
            // Hide/show the eastGlue and the horizontalScrollBar, and recalculate the
            // minimum size of the footerPanel in response to size and visibility changes.
            syncScrollBarVisibility(centerScrollPane, eastGlue, horizontalScrollBar, footerPanel);
            setLayout(new BorderLayout());
            add("Center", box);
        private void syncScrollBarVisibility(final JScrollPane centerScrollPane,
                                             final Component eastGlue,
                                             final JScrollBar horizontalScrollBar,
                                             final JPanel footerPanel) {
            // Hide/show the eastGlue accoring to whether or not the vertical scrollbar
            // is visible.
            centerScrollPane.getVerticalScrollBar().addComponentListener(new ComponentListener() {
                private void checkVisibleStatus(boolean b) {
                    if (eastGlue.isVisible() != b) {
                        eastGlue.setVisible(b);
                public void componentHidden(ComponentEvent e) {
                    checkVisibleStatus(false);
                public void componentMoved(ComponentEvent e) {
                public void componentResized(ComponentEvent e) {
                public void componentShown(ComponentEvent e) {
                    checkVisibleStatus(true);
            // Hide/show the horizontal scrollbar according to whether or not it's needed.
            centerScrollPane.getViewport().addComponentListener(new ComponentListener() {
                public void componentHidden(ComponentEvent e) {
                public void componentMoved(ComponentEvent e) {
                public void componentResized(ComponentEvent e) {
                    int centerScrollPaneWidth = centerScrollPane.getViewport().getSize().width;
                    int centerTablePreferredWidth = centerTable.getPreferredSize().width;
                    if (centerScrollPaneWidth >= centerTablePreferredWidth) {
                        horizontalScrollBar.setVisible(false);
                    } else {
                        horizontalScrollBar.setVisible(true);
                public void componentShown(ComponentEvent e) {
            // Set the minimum size of the footerPanel according to whether or not the
            // horizontalScrollBar is visible.
            horizontalScrollBar.addComponentListener(new ComponentListener() {
                public void componentHidden(ComponentEvent e) {
                    footerPanel.setMinimumSize(footerPanel.getPreferredSize());
                public void componentMoved(ComponentEvent e) {
                public void componentResized(ComponentEvent e) {
                public void componentShown(ComponentEvent e) {
                    footerPanel.setMinimumSize(footerPanel.getPreferredSize());
        private void syncScrolling(final JScrollPane centerScrollPane,
                                   final JScrollBar columnFooterScrollBar,
                                   final JScrollPane columnFooterScrollPane) {
            // When the view of the center scroll pane changes position,
            // change the value of the columnFooterScrollBar to match.
            centerScrollPane.getViewport().addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    int x = ((Component) e.getSource()).getLocation().x * -1;
                    JViewport viewport = (JViewport) e.getSource();
                    int extentWidth = viewport.getExtentSize().width;
                    int viewWidth = viewport.getViewSize().width;
                    int value = Math.max(0, Math.min(viewport.getViewPosition().x, viewWidth - extentWidth));
                    columnFooterScrollBar.setValues(value, extentWidth, 0, viewWidth);
            // When the columnFooterScrollBar (horizontal scroll bar) value changes,
            // change the position of the view in the center scroll pane to match.
            columnFooterScrollBar.addAdjustmentListener(new AdjustmentListener() {
                public void adjustmentValueChanged(AdjustmentEvent e) {
                    JViewport viewport = centerScrollPane.getViewport();
                    viewport.setViewPosition(new Point(e.getValue(), viewport.getViewPosition().y));
                    viewport = columnFooterScrollPane.getViewport();
                    viewport.setViewPosition(new Point(e.getValue(), viewport.getViewPosition().y));
            // When the view of the row header changes position,
            // change the value of the vertical scrollbar of the center
            // scroll pane to match.
            centerScrollPane.getRowHeader().addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    JViewport viewport = (JViewport) e.getSource();
                    int extentHeight = viewport.getExtentSize().height;
                    int viewHeight = viewport.getViewSize().height;
                    int value = Math.max(0, Math.min(viewport.getViewPosition().y, viewHeight - extentHeight));
                    centerScrollPane.getVerticalScrollBar().setValues(value, extentHeight, 0, viewHeight);
        public JTable getCenterTable() {
            return centerTable;
        public JTable getRowHeaderTable() {
            return rowHeaderTable;
        private JTable getColumnFooterTable() {
            return columnFooterTable;
        public static void main(String[] args) {
            AbstractHeaderFooterTableModel tableModel = new AbstractHeaderFooterTableModel() {
                public int getRowCount() {
                    return 25;
                public int getColumnCount() {
                    return 10;
                public Object getValueAt(int rowIndex, int columnIndex) {
                    return "Cell " + rowIndex + ":" + columnIndex;
                public String getColumnName(int column) {
                    return "Column #" + column;
                public Object getRowHeaderValueAt(int rowIndex, int columnIndex) {
                    return "Header " + rowIndex + ":" + columnIndex;
                public int getRowHeaderColumnCount() {
                    return 2;
                public Object getFooterValueAt(int rowIndex, int columnIndex) {
                    return "Footer " + rowIndex + ":" + columnIndex;
                public int getFooterRowCount() {
                    return 3;
            JFrame frame = new JFrame();
            HeaderFooterTablePanel tablePanel = new HeaderFooterTablePanel(tableModel);
            // Render the cells in the row header and footer like the center table column headers.
            TableCellRenderer columnRenderer = tablePanel.getCenterTable().getTableHeader().getDefaultRenderer();
            tablePanel.getRowHeaderTable().setDefaultRenderer(Object.class, columnRenderer);
            tablePanel.getColumnFooterTable().setDefaultRenderer(Object.class, columnRenderer);
            frame.getContentPane().add("Center", tablePanel);
            frame.setSize(300, 300);
            frame.setLocation(300, 200);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }

    i was wondering why this topic has NO replies! and then i realized that there is NO question??? so do you have a question, or are you just starting a new thread cuz you feel like it???
    just trying to work out why you didnt post this is the old thread???
    http://forum.java.sun.com/thread.jspa?threadID=5130131&messageID=9466400#9466400

  • My version of a table with row headers and column footers

    I checked the web and some java books over the
    weekend. Didn't find any examples so I'm
    probably not the only one wanting this.
    Here's my version:
    import javax.swing.*;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableColumnModel;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class RowHeaderColumnFooterTableExample extends JFrame {
        private static class TableDataModel extends AbstractTableModel {
            public TableDataModel() {
                super();
            public String getColumnName(int column) {
                return "Column #" + column;
            public Object getRowHeader(int rowIndex) {
                return "Row #" + rowIndex;
            public Object getRowFooter(int columnIndex) {
                return "Footer #" + columnIndex;
            public int getColumnCount() {
                return 25;
            public int getRowCount() {
                return 25;
            public Object getValueAt(int rowIndex, int columnIndex) {
                return "Cell " + rowIndex + ":" + columnIndex;
        private static class RowHeaderTableModel extends AbstractTableModel {
            private TableDataModel tableDataModel;
            public RowHeaderTableModel(TableDataModel tableDataModel) {
                super();
                this.tableDataModel = tableDataModel;
            public String getColumnName(int column) {
                return "";
            public int getColumnCount() {
                return 1;
            public int getRowCount() {
                return tableDataModel.getRowCount();
            public Object getValueAt(int rowIndex, int columnIndex) {
                return tableDataModel.getRowHeader(rowIndex);
        private static class FooterTableModel extends AbstractTableModel {
            private TableDataModel tableDataModel;
            public FooterTableModel(TableDataModel tableDataModel) {
                super();
                this.tableDataModel = tableDataModel;
            public String getColumnName(int column) {
                return tableDataModel.getRowFooter(column).toString();
            public int getColumnCount() {
                return tableDataModel.getColumnCount();
            public int getRowCount() {
                return 0;
            public Object getValueAt(int rowIndex, int columnIndex) {
                throw new RuntimeException("This model holds column names only - no values.");
        private static class SyncColumnWidths implements TableColumnModelListener {
            private final JTable centerTable;
            private final JTable footerTable;
            public SyncColumnWidths(JTable centerTable,
                                    JTable footerTable) {
                this.centerTable = centerTable;
                this.footerTable = footerTable;
            // Change the column widths of the footer table when the column widths
            // of the center table change.
            public void columnMarginChanged(ChangeEvent e) {
                TableColumnModel centerTableColumnModel = centerTable.getColumnModel();
                TableColumnModel footerTableColumnModel = footerTable.getColumnModel();
                for (int i = 0; i < centerTableColumnModel.getColumnCount(); i++) {
                    int width = centerTableColumnModel.getColumn(i).getPreferredWidth();
                    footerTableColumnModel.getColumn(i).setPreferredWidth(width);
            public void columnSelectionChanged(ListSelectionEvent e) {
            public void columnAdded(TableColumnModelEvent e) {
            public void columnMoved(TableColumnModelEvent e) {
            public void columnRemoved(TableColumnModelEvent e) {
        public RowHeaderColumnFooterTableExample() {
            super();
            // Create the main table data model
            TableDataModel tableDataModel = new TableDataModel();
            // Create the center, rowHeader and footer tables
            final JTable centerTable = new JTable(tableDataModel);
            final JTable rowHeaderTable = new JTable(new RowHeaderTableModel(tableDataModel));
            final JTable footerTable = new JTable(new FooterTableModel(tableDataModel));
            // Render the cells in the row header like the column headers.
            rowHeaderTable.setDefaultRenderer(Object.class, new JTableHeader().getDefaultRenderer());
            // Disabled column re-ordering
            centerTable.getTableHeader().setReorderingAllowed(false);
            footerTable.getTableHeader().setReorderingAllowed(false);
            // We are using scroll panes, so no auto resizing of table.
            centerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            footerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            // Only allow the user to change the column widths from the center table, not the
            // footer.
            footerTable.getTableHeader().setResizingAllowed(false);
            // When the center table column widths change, change those in the footer table.
            SyncColumnWidths syncColumnWidths = new SyncColumnWidths(centerTable, footerTable);
            centerTable.getColumnModel().addColumnModelListener(syncColumnWidths);
            // Set the width of the row header before adding it to the center scroll pane
            // as the row header.
            Dimension rowHeaderSize = rowHeaderTable.getPreferredScrollableViewportSize();
            rowHeaderSize.width = rowHeaderTable.getPreferredSize().width;
            rowHeaderTable.setPreferredScrollableViewportSize(rowHeaderSize);
            rowHeaderTable.setRowHeight(centerTable.getRowHeight());
            // Create the center scroll pane and set the row header table as the row header.
            final JScrollPane centerScrollPane = new JScrollPane(centerTable);
            centerScrollPane.setRowHeaderView(rowHeaderTable);
            // We will handle horizontal scrolling with our own scrollbar.
            centerScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            // Now we create the panel to hold the footer table and the horizontal
            // scrollbar.
            JPanel footerPanel = new JPanel(new BorderLayout());
            // Keep the space below the row header empty.
            Component westStrut = Box.createHorizontalStrut(rowHeaderSize.width);
            // Set height of the footer table before adding it to the footer scroll pane
            // as the view.
            Dimension footerSize = footerTable.getPreferredScrollableViewportSize();
            footerSize.height = footerTable.getPreferredSize().height;
            footerTable.setPreferredScrollableViewportSize(footerSize);
            footerTable.setRowHeight(centerTable.getRowHeight());
            // The scroll pane which holds the footer table.
            final JScrollPane footerScrollPane = new JScrollPane(footerTable);
            // We do our own horizontal scrolling and the footer never scrolls vertically.
            footerScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            footerScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
            // The scrollbar we use to scroll horizontally.
            final JScrollBar footerScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
            // The panel that holds the footer table and the horizontal scrollbar below it.
            JPanel footerCenterPanel = new JPanel(new GridLayout(2, 0));
            footerCenterPanel.add(footerScrollPane);
            footerCenterPanel.add(footerScrollBar);
            // Sync up all the scrolling. See the method for details.
            syncScrolling(centerScrollPane, footerScrollBar, footerScrollPane);
            // Keep the space below the vertical scrollbar empty.
            JScrollBar verticalScrollBar = centerScrollPane.getVerticalScrollBar();
            int verticalScrollBarWidth = verticalScrollBar.getPreferredSize().width;
            Component eastStrut = Box.createHorizontalStrut(verticalScrollBarWidth);
            // Assemble our footer Panel.
            footerPanel.add("West", westStrut);
            footerPanel.add("Center", footerCenterPanel);
            footerPanel.add("East", eastStrut);
            // Final assembly.
            Container contentPane = getContentPane();
            contentPane.setLayout(new BorderLayout());
            contentPane.add("Center", centerScrollPane);
            contentPane.add("South", footerPanel);
        private void syncScrolling(final JScrollPane centerScrollPane,
                                   final JScrollBar footerScrollBar,
                                   final JScrollPane footerScrollPane) {
            // When the view of the center scroll pane changes position,
            // change the value of the footer scrollbar to match.
            centerScrollPane.getViewport().addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    int x = ((Component) e.getSource()).getLocation().x * -1;
                    JViewport viewport = (JViewport) e.getSource();
                    int extentWidth = viewport.getExtentSize().width;
                    int viewWidth = viewport.getViewSize().width;
                    int value = Math.max(0, Math.min(viewport.getViewPosition().x, viewWidth - extentWidth));
                    footerScrollBar.setValues(value, extentWidth, 0, viewWidth);
            // When the footer scroll bar (horizontal scroll bar) value changes,
            // change the position of the view in the center scroll pane to match.
            footerScrollBar.addAdjustmentListener(new AdjustmentListener() {
                public void adjustmentValueChanged(AdjustmentEvent e) {
                    JViewport viewport = centerScrollPane.getViewport();
                    viewport.setViewPosition(new Point(e.getValue(), viewport.getViewPosition().y));
                    viewport = footerScrollPane.getViewport();
                    viewport.setViewPosition(new Point(e.getValue(), viewport.getViewPosition().y));
            // When the view of the row header changes position,
            // change the value of the vertical scrollbar of the center
            // scroll pane to match.
            centerScrollPane.getRowHeader().addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    JViewport viewport = (JViewport) e.getSource();
                    int extentHeight = viewport.getExtentSize().height;
                    int viewHeight = viewport.getViewSize().height;
                    int value = Math.max(0, Math.min(viewport.getViewPosition().y, viewHeight - extentHeight));
                    centerScrollPane.getVerticalScrollBar().setValues(value, extentHeight, 0, viewHeight);
        public static void main(String[] args) {
            RowHeaderColumnFooterTableExample rowHeaderColumnFooterTableExample = new RowHeaderColumnFooterTableExample();
            rowHeaderColumnFooterTableExample.setSize(300, 300);
            rowHeaderColumnFooterTableExample.setLocation(300, 200);
            rowHeaderColumnFooterTableExample.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            rowHeaderColumnFooterTableExample.setVisible(true);
    }null
    Message was edited by:
    NY_Consultant
    Message was edited by:
    NY_Consultant

    Just for reference, you can also check here for a RowHeader example
    http://www.crionics.com/products/opensource/faq/swing_ex/JTableExamples1.html
    and here for a column footer (or total row)
    http://www.crionics.com/products/opensource/faq/swing_ex/JTableExamples3.html
    as well as numerous other useful ideas. The source can also be found at
    http://www.physci.org/codes/tame/
    though without the screen shots.

  • Display one or more rows for a particular column in alv grid display

    Hi,
    My requirement in the report is to display users for a particular workitem id.If a workitem is in the inbox of one or more users(approvers) i have to display all the user names in one field in alv grid output (output-approver id).There are other fields which display details of the workitem also.
    Is there a way to populate multiple rows for a single column or creating one more internal table for users in the alv output table.
    Please suggest.
    regards,
    Sravanthi Chilal

    ALV only can show flat internal table data.
    you should set a sort on the field which you want to show only once.
    Then on the output of the ALV, the field with the same value will show only once.

  • Hide row values for certain column in GRR2

    Hi Experts,
    Looking for some help in report painter. I need to hide row values for certain columns in report painter. The requirement is I have 5 columns in the report, the 5 th column is the sum of col 1 to 4 and in my row i have a formula setup to sum of values for each column, what i would like to do is for column 1 thru 4 i didnt want to display the total values in row total but i wanted to dispaly value for column 5 in row total. I have been trying my best with putting formula, but couldnt succeed.
    Could somebody let me know is there an way to get this addressed.
    Thanks in advance
    Best Regards,
    gj

    How was it achieved ? Did you use sections for the columns for which rows needed to be hidden?
    I have a smiliar issue of hiding certain rows for few columns.

Maybe you are looking for