none
Table within Table -- Possible?

    Question

  • I am dynamically generating RDLC for the local report viewer control.  I am having a problem nesting a Table within another Table.  There must be (?) functionality like this supported.  How is it possible to nest a Table within another Table.  I believe a data region is not allowed inside of another data region (such as Table2 as the only ReportItem under Table1's ReportItems); is this correct?  If so, what is the way to achieve this functionality?  Any help is greatly appreciated; thanks.
    Monday, August 13, 2007 2:59 PM

Answers

  • Actually, this functionality *is* supported.  You *can* put a data region inside another data region.  I don't think you can do it in the detail band of a table, though.  Is that what you tried?

     

    Do it interactively and drag the table to a footer band -- you'll see what I mean.

     

    I have nested a matrix or a list, or a subreport, inside a table as well  -- but the same rules apply.  Not in the detail band.

     

    You may also want to nest a table or a matrix inside a list region -- I am pretty sure the Wizard actually does this if you use it to start off a report, so generate a layout and take a look at that.

     

    >L<

     

     

    Wednesday, August 15, 2007 4:15 PM

All replies

  •  

    Have you tried drag-and-drop a table to another table's column?Or can't list do the trick??
    Tuesday, August 14, 2007 1:08 AM
  • Note: This is done using XMLTextWriter (I am serializing the RDL manually), so I cannot use drag n' drop here, unfortunately.  Secondly, I've thought of using a list to organize each of my ReportItems (acting like a flow layout), but I'm not entirely sure how this would be accomplished.  Could anyone provide example RDL of hosting multiple tables within either a List or an all-encompassing Table?  Thanks in advance!
    Tuesday, August 14, 2007 9:33 PM
  •  

    As for now,just try to add a table in your first table columns,until we got the solution.I will try to find what you are asking..hehe
    Wednesday, August 15, 2007 12:44 AM
  • I'll play around with it a bit tomorrow sometime; thanks for any help you can offer.
    Wednesday, August 15, 2007 3:05 AM
  • Your right on what you had first said,my mistake.You cannot put a data region in another data region.hehe

    Wednesday, August 15, 2007 8:14 AM
  • Actually, this functionality *is* supported.  You *can* put a data region inside another data region.  I don't think you can do it in the detail band of a table, though.  Is that what you tried?

     

    Do it interactively and drag the table to a footer band -- you'll see what I mean.

     

    I have nested a matrix or a list, or a subreport, inside a table as well  -- but the same rules apply.  Not in the detail band.

     

    You may also want to nest a table or a matrix inside a list region -- I am pretty sure the Wizard actually does this if you use it to start off a report, so generate a layout and take a look at that.

     

    >L<

     

     

    Wednesday, August 15, 2007 4:15 PM
  • So does this mean that to accomplish a table w/in a table I just need to put the inner table inside of the header/footer of the outer table?  The main thing I'm trying to accomplish is to provide flow layout type behavior.  I have tried to get the report to properly separate elements, and I was hoping that nesting them inside of table rows would do the trick; so then could I put each table within a row of the header/footer of another table?  If so ...  example RDL?

    The issue that I was hoping to resolve with this is that large tables overlap tables that follow them.  In other words, the end of the table (last few rows) will be rendered on top of the beginning of the table following it.  Do you have any suggestions for resolving that?  I was happy to get the pagebreak stuff working; pagination is now functional, but the tables still overlap Sad.  Any help is greatly appreciated.  Thanks!
    Friday, August 17, 2007 2:28 PM
  •  

    Yes, that is how you do it. (Put it in the header or footer) But if you're doing this because you have an overlapping table problem, I think you should figure out why your generated results are doing that.  There has to be something you're doing, or not doing, that is causing the behavior...

     

    >> If so... example RDL

     

    I'm sorry, it really doesn't make sense for me to do this.  All you have to do is start a simple report in the Report Designer.  Put in a table.  Drag a table to a cell in its footer.  Look at the RDL.

     

    I would also suggest that you do an interactive design that shows multiple tables, *without* nesting, and compare the result, first by previewing and then by doing an XML-DIFF, with what you have generated.  You are probably missing something minor but critical, and you should be able to find it <s>.  If you cannot, I could look at *your* RDL and try to figure it out -- but I'm going off-line for about a week and a half shortly....

     

    As another suggestion: if you can't do the layout you want to do without nesting data regions and if your reason is layout-related, you should look at nesting a table inside a list. 

     

     I have this feeling that you have chosen to nest tables inside tables because you're thinking in HTML layout terms. Actually it's considered somewhat bad form to use tables for layout in HTML these days, but still many people find it easier to do this -- including me, in some cases! <s> 

     

    The point I'm making here -- it's sort of an analogy -- but sometimes when you are thinking tables-for-layout in HTML you should really be thinking divs and learning to control them properly.  And here I'm saying I think that lists are better containers for what you probably have in mind -- always assuming, again, that you actually do need container data regions.

     

    Notice I'm calling them data regions.  That's what they are.  They're not really layout regions.  Another clue that nesting tables inside tables for layout purposes may be perverting/contorting their concept. 

     

    If the purpose of a table were to serve as a layout region, from RS's point of view, I'm sure you *would* be able to nest tables in the detail row of tables <s>.

     

    This is probably more detail than you want, but frankly I think you need to think about the RDL somewhat deeply -- what are the intented of the various elements of the schema? -- if you want to generate RDLs rather than simply consuming them.  Don't rush into this, no matter how easy (or brain-dead?) the examples you'll see in the docs etc are.

     

    >L<

    Friday, August 17, 2007 2:47 PM
  • <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
                <DataSources>
                   <DataSource Name="DummyDataSource">
                      <ConnectionProperties>
                         <ConnectString>NO_CONNECT_STRING;</ConnectString>
                         <DataProvider>SQL</DataProvider>
                      </ConnectionProperties>
                   </DataSource>
                </DataSources>
                <DrawGrid xmlns="rd">true</DrawGrid>
                <SnapToGrid xmlns="rd">true</SnapToGrid>
                <ReportID xmlns="rd">0f62db19-7f80-4922-b1fa-1a1b01f8caa7</ReportID>
                <PageHeight>8.5in</PageHeight>
                <PageWidth>11in</PageWidth>
                <InteractiveHeight>8.5in</InteractiveHeight>
                <InteractiveWidth>11in</InteractiveWidth>
                <Width>10.5in</Width>
                <Language>en-US</Language>
                <TopMargin>0.25in</TopMargin>
                <LeftMargin>0.25in</LeftMargin>
                <BottomMargin>0.25in</BottomMargin>
                <RightMargin>0.25in</RightMargin>
                <Body>
                      <Height>7.5in</Height>
                      <ReportItems>
                         <Table Name="Cals1">
                         <DataSetName>DataSet_16</DataSetName>
                         <DataElementOutput>Output</DataElementOutput>
                         <Top>0in</Top>
                         <Left>0in</Left>
                         <PageBreakAtStart>true</PageBreakAtStart>
                         <Style>
                            <FontSize>7.5pt</FontSize>
                            <BorderStyle><Default>Solid</Default></BorderStyle>
                         </Style>
                         <Details>
                            <TableRows>
                               <TableRow>
                                  <TableCells>
                                     <TableCell>
                                        <ReportItems>
                                           <Textbox Name="INDEX_402">
                                           <CanGrow>true</CanGrow>
                                              <Value>=Fields!INDEX.Value                                          </Value>
                                           </Textbox>
                                        </ReportItems>
                                     </TableCell>
                                     ...
                                  </TableCells>
                               <Height>0.1in</Height>
                               </TableRow>
                            </TableRows>
                         </Details>
                         <Header>
                         <TableRows>
                            <TableRow>
                               <TableCells>
                                  ...
                               </TableCells>
                            <Height>0.1in</Height>
                            </TableRow>
                         </TableRows>
                      </Header>
                      <TableColumns>
                         <TableColumn>
                            <Width>0.3257764in</Width>
                         </TableColumn>
                         ...
                         </TableColumns>
    </Table>
                         <Table Name="Cals2">
                         <DataSetName>DataSet_18</DataSetName>
                         <DataElementOutput>Output</DataElementOutput>
                         <Top>0.15in</Top>
                         <Left>0in</Left>
                         <PageBreakAtStart>true</PageBreakAtStart>
                         <Style>
                            <FontSize>7.5pt</FontSize>
                            <BorderStyle><Default>Solid</Default></BorderStyle>
                         </Style>
                         <Details>
                            <TableRows>
                               <TableRow>
                                  <TableCells>
                                     <TableCell>
                                        <ReportItems>
                                           <Textbox Name="INDEX_452">
                                           <CanGrow>true</CanGrow>
                                              <Value>=Fields!INDEX.Value                                          </Value>
                                           </Textbox>
                                        </ReportItems>
                                     </TableCell>
                                     ...
                                  </TableCells>
                               <Height>0.1in</Height>
                               </TableRow>
                            </TableRows>
                         </Details>
                         <Header>
                         <TableRows>
                            <TableRow>
                               <TableCells>
                                  <TableCell>
                                     <ReportItems>
                                        <Textbox Name="INDEX_466">
                                        <CanGrow>true</CanGrow>
                                           <Value>Index                                       </Value>
                                        </Textbox>
                                     </ReportItems>
                                  </TableCell>
                                  ...
                               </TableCells>
                            <Height>0.1in</Height>
                            </TableRow>
                         </TableRows>
                      </Header>
                      <TableColumns>
                         <TableColumn>
                            <Width>0.6724359in</Width>
                         </TableColumn>
                         ...
                         </TableColumns>
    </Table>
                      </ReportItems>
                   </Body>
                   <DataSets>
                      <DataSet Name="DataSet_16">
                         <DataSetInfo xmlns="rd">DataSet_16<DataSetName>DataSet_16</DataSetName><TableName>Cals1</TableName></DataSetInfo>
                         <Query>
                            <UseGenericDesigner xmlns="rd">true</UseGenericDesigner>
                            <CommandText />
                            <DataSourceName>DummyDataSource</DataSourceName>
                         </Query>
                         <Fields>
                            <Field Name="INDEX">
                               <TypeName xmlns="rd">System.Int32</TypeName>
                               <DataField>INDEX</DataField>
                            </Field>
        ...
                         </Fields>
                      </DataSet>
                      <DataSet Name="DataSet_18">
                         <DataSetInfo xmlns="rd">DataSet_18<DataSetName>DataSet_18</DataSetName><TableName>Cals2</TableName></DataSetInfo>
                         <Query>
                            <UseGenericDesigner xmlns="rd">true</UseGenericDesigner>
                            <CommandText />
                            <DataSourceName>DummyDataSource</DataSourceName>
                         </Query>
                         <Fields>
                            <Field Name="INDEX">
                               <TypeName xmlns="rd">System.Int32</TypeName>
                               <DataField>INDEX</DataField>
                            </Field>...
                         </Fields>
                      </DataSet>
                      <DataSet Name="DummyDataSet">
                         <DataSetInfo xmlns="rd">DummyDataSet<DataSetName>DummyDataSet</DataSetName><TableName>Table1</TableName></DataSetInfo>
                         <Query>
                            <UseGenericDesigner xmlns="rd">true</UseGenericDesigner>
                            <CommandText />
                            <DataSourceName>DummyDataSource</DataSourceName>
                         </Query>
                         <Fields>
                            <Field Name="Column1">
                               <TypeName xmlns="rd">System.String</TypeName>
                               <DataField>Column1</DataField>
                            </Field>
                         </Fields>
                      </DataSet>
                   </DataSets>
                   <PageFooter>
                   <Height>0.5in</Height>
                   <PrintOnFirstPage>true</PrintOnFirstPage>
                   <PrintOnLastPage>true</PrintOnLastPage>
                      <ReportItems>
                         <Textbox Name="footerBox1">
                            <DefaultName xmlns="rd">footerBox1</DefaultName>
                            <CanGrow>true</CanGrow>
                            <CanShrink>true</CanShrink>
                            <Value>="[Page " &amp; Globals!PageNumber &amp; " of " &amp; Globals!TotalPages  &amp; "]" &amp; Environment.NewLine &amp; "Report Time: 2007-08-17 11:11:31.906 Version: 1.0.4.1337"</Value>
                         </Textbox>
                      </ReportItems>
                   </PageFooter>
    </Report>
    Friday, August 17, 2007 3:22 PM
  • Note, clearly not runnable; I've stripped out all the <Style> tags and replaced a lot of TableCells with ellipses.  Thanks for the info; let me know if you see anything that may be causing the overlapping.  For position, I am assigning lastPos + 0.25in (arbitrary), and there are PageBreakAtStart tags thrown onto the Tables so that they will handle pagination.  Everything looks great when exported to Excel, and the report appeared correct when I had tested it against smaller datatables, but there are potentially very long tables.

    You've been already more than helpful; thanks for your time, Lisa!
    Friday, August 17, 2007 3:27 PM
  • Dude, I'm sorry -- I really have to run out the door -- and it isn't really likely that it is going to be something I *see* that "triggers the overlap" but rather something that is missing -- so stripping out stuff probably isn't a good idea in this case, I won't know what you stripped out that might be significant. 

     

    That's why I suggested an XMLDiff after you do an interactive design to see what might be different.


    OTOH, if you do an interactive design and the issue still occurs, you will know that your generation process is off the hook <s>. If this happens, you will know to start looking elsewhere, for example if this is used in a webform app, look at your doctype.  Again, the styles would be critical here so looked at a stripped RDL can't really help me see it...

     

    >L<

     

    Friday, August 17, 2007 6:04 PM