Binding Multiple tables to Report

13 posts, 0 answers
  1. rajesh
    rajesh avatar
    13 posts
    Member since:
    Oct 2007

    Posted 25 Mar 2009 Link to this post

    Hi,

    I am using Telerik Reporting Controls in my application.I have a requirement where i will be having more than one table in a dataset.
    i need to bind the data of first table to header and second table data to body and third table data to footer.

    can it be possible to do like that.if it is then can you please let me know regarding this.

    Thanks & Regards,

    Rajesh
  2. Ivan
    Admin
    Ivan avatar
    111 posts

    Posted 25 Mar 2009 Link to this post

    Hello rajesh,

    Telerik Reporting supports data-bound items in the report header/footer sections, group header/footer sections, and the detail section of a report. Data-bound items in the page header/footer sections are not supported, because it does not make sense. You can bind to more than one DataTable from a DataSet, of course.

    You can visit our online documentation to familiarize yourself with the different report sections and the supported data binding. Check our online examples too, to see if any of them does something similar to what you are trying to accomplish.

    We are sorry that we can not be more helpful, but since we do not know your specific requirements, this is the best we can tell you so far. If you have more specific questions regarding Telerik Reporting, please, do not hesitate to ask.

    Greetings,

    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Dave
    Dave avatar
    3 posts
    Member since:
    Jun 2007

    Posted 18 Sep 2009 Link to this post

    I was just reading your posts to find out myself how to bind to more then one table in a Dataset and from your answer you stated that
    "You can bind to more than one DataTable from a DataSet, of course."

    You also linked to the data binding page and this is what that say's.  Unless I am missing something this is conflicting information.

    "Telerik Reporting can be bound to a single table only. If your DataSource contains more tables, you can bind a separate report to it and take advantage of a subreport item or use table item to directly show data in main report."

    Can you tell me what is correct?  I am not seeing how you can use fields from more then one table using the Report wizard and a dataset with more then one table.

    Thanks,
    Dave
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 22 Sep 2009 Link to this post

    Hi Dave,

    The explanation from my colleague's post only explains that this is possible, while the information in the documentation explains how to bind to more DataTables - via table/crosstab or subreport items. The wizard allows you to bind to a single DataTable and as explained - this is by design.

    Regards,
    Steve
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 31 Aug 2011 Link to this post

    How would you access a particular table at design time?  I'm using WCF webservices.  I need the codebehind code, and what settings or extra code I would need in the actual report itself.  I have multiple tables, but I can't seem to figure out how to access a particular table at run time.  There must be some code to set the datasource to a particular table, but I've tried many things including:

    report.DataSource = dataset.Tables[0];


    My fields are coming up blank.  But, with a ONE table dataset, it works perfectly.



    Thanks.
  7. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 05 Sep 2011 Link to this post

    Hello Chris,

    If you prefer to design the report in Visual Studio designer with multiple tables you should use as many DataSource components as the number of the required tables. As I see from your explanation you are using  a DataSet but you do not show how the tables are filled with data and where and when this happen in your code.

    We highly recommend you to open support ticket in order to send us a sample project demonstrating the issue.

    Regards,
    Hrisi
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Chris @ Intrinsic
    Chris @ Intrinsic avatar
    98 posts
    Member since:
    Oct 2010

    Posted 07 Sep 2011 Link to this post

    I figured it out, thanks.  It was the fact that I had to bind a datatable to each object, such as a table, etc.  I can't use two different datasources for the main report, only one, but the objects such as subreport, table have to be in the detail section, not in the main page area, etc.

  9. Emix
    Emix avatar
    4 posts
    Member since:
    Mar 2013

    Posted 04 Mar 2013 Link to this post

    Hi Telerik Team

    I want to make one stock report which contains data from 3 tables(sql) as given below. I want to show(select) all Products from 3 Tables, but products from “Purchase_Table” and  “Sale_Table”  should be between the user mentioned date (E.g.: 01-Jan-2013 to 01-March-2013, Date column(Filed) not mentioned in following Sales and Purchase Table but it is there). All Products from 3 tables should be grouped together according to their Product ID as given below(Stock Report).

    1. Stock_Table

    Product_ID

    Product_Name

    Opening_Stock

    Current_Stock

    Unit_Price

    Total_Cost

    101

    Monitor

    20

    10

    7200

    72000

    102

    Keyboard

    15

    12

    500

    6000

    103

    Speaker

    6

    6

    2000

    12000

    104

    Printer

    10

    15

    6000

    90000

    105

    Scanner

    5

    10

    4500

    45000

    106

    Hard Disk

    25

    25

    2500

    62500

    107

    CD ROM

    15

    5

    2100

    10500

    108

    Mother Board

    20

    20

    3500

    70000

    2. Purchase_Table

    Product_ID

    Product_Name

    Purchase_Quantity

    Unit_Price

    Total_Cost

    104

    Printer

    5

    6000

    30000

    105

    Scanner

    15

    4500

    67500

    107

    CD ROM

    5

    2100

    10500

    3. Sale_Table

    Product_ID

    Product_Name

    Sold_Quantity

    Unit_Price

    Total_Amount

    Profit

    101

    Monitor

    10

    7500

    75000

    3000

    102

    Keyboard

    3

    2200

    6600

    600

    105

    Scanner

    10

    5000

    50000

    5000

    107

    CD ROM

    15

    2300

    34500

    3000

    Stock Reort

    Pro ID

    Product Name

    Opening

    Purchase

    Sale

    Closing

    QTY

    Amount

    QTY

    Amount

    QTY

    Amount

    QTY

    Amount

    101

    Monitor

    20

    144000

    10

    75000

    10

    72000

    102

    Keybord

    15

    7500

    3

    6600

    12

    6000

    103

    Speaker

    6

    12000

    6

    12000

    104

    Printer

    10

    60000

    5

    30000

    15

    90000

    105

    Scanner

    5

    22500

    15

    67500

    10

    50000

    10

    45000

    106

    Hard Disk

    25

    62500

    25

    62500

    107

    CD ROM

    15

    31500

    5

    10500

    15

    34500

    5

    10500

    108

    Mother Board

    20

    70000

    20

    70000



    Hope I will get solution soon, Thanks in advance...
  10. Emix
    Emix avatar
    4 posts
    Member since:
    Mar 2013

    Posted 04 Mar 2013 Link to this post

    Please Reply....
  11. Hadib Ahmabi
    Hadib Ahmabi avatar
    181 posts
    Member since:
    Nov 2011

    Posted 04 Mar 2013 Link to this post

    Your scenario is actually pretty simple. You should JOIN the 3 tables, add WHERE clause for the dates and bind the data-source to a table. 
    Most of the demos show how to work with parameters: http://demos.telerik.com/reporting/home.aspx , take a look at them and you should be able to do your report. 
  12. Emix
    Emix avatar
    4 posts
    Member since:
    Mar 2013

    Posted 06 Mar 2013 Link to this post

    Hi Hadib Ahmabi,
    God bless you,
    I already used WHERE clause in my code snippette, but it only returns a product(s) which is stored on each 3 table). According to my table data mentioned above, when using WHERE clause it only returns 2 Products that is, 105, 107(Product ID is mentioned here). I want to Show detail of all products from Stock Table whether it is Available on other two tables or not. If it is available on other two table I need to merge these products with products from stock table according to user mentioned period (Date). Note that there is no date field in stock table. Just refer my table diagram given above.

  13. Hadib Ahmabi
    Hadib Ahmabi avatar
    181 posts
    Member since:
    Nov 2011

    Posted 07 Mar 2013 Link to this post

    That's because you are making INNER JOIN. Try with OUTER JOIN.
    LEFT OUTER JOIN between Stock Table and the other table should be the right one. 
    See http://en.wikipedia.org/wiki/Join_(SQL)
  14. Umar
    Umar avatar
    1 posts
    Member since:
    Nov 2012

    Posted 07 May 2014 Link to this post

    You can bind to more than one DataTable from a DataSet, of course.

    HOW?
Back to Top
DevCraft banner