Multiple DataSource

15 posts, 0 answers
  1. David Hosey
    David Hosey avatar
    14 posts
    Member since:
    Jan 2008

    Posted 14 May 2008 Link to this post

    Hello,

    I have to generate a report that can be exported to PDF.
    This report is consist of 4 section (like sub report) and each has a different data source as each would call a different store procedure.

    How can I have multiple data source. Do I have to design them sepratly and put them all as a sub report into a master report or can I have each table for each section in one report... ?

    I know for fact it is possible in the Crystal Report Basic that comes with Visual Studio but it is so basic and crap. But you can design each report individually and just drag and drop them into a master report. Each one knows its own data source and you do not have to specify any data source for the master report. Is this possible in Telerik Reporting?

    Thanks in advance for your help.

    Regards,
    Mehdi
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 15 May 2008 Link to this post

    Hi David,

    Thank you for contacting us.

    In your case you should create one master report and place 4 SubReport items in it. Then create 4 reports for each SubReport item and associate the SubReport items with the respective report that they are going to show. Finally, attach to the NeedDataSource event of each of the SubReport items and there you can bind to virtually any data source that you wish.

    You can learn more about the SubReport item here. The other topic that you should definitely check out is Using Report Events and finally, this forum topic discusses the usage of SubReports in greater detail.

    Hope this helps. Do not hesitate to drop us a line if you encounter any problems or difficulties.

    All the best,
    Ross
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
  4. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 10 Oct 2012 Link to this post

    Hi,

    • Is the scenario still the same or it has got improved ? I need to have multiple tables with different datasources (stored procedures of the same database, mostly).
    • I too need to flourish my parameters like check box list and / or drop down list from stored procedure / simple select query from other database.
          (but looks like this can be taken care at the time of adding the corresponding datasource )

    • I tried to add multiple datasources to the report from within wizard but inthe 'Design Data Layout' only one (selected) was allowed. However though I was able to select multiple ones from the Choose data source step, one seemed to be permissible in the Layout step.
    • I might be missing something , but is there any way out where I can use the data source and datasets. (where datasource is the database connectivity info, and datasets hae query / SP , Parameters & Fields - this seems more meaningful and hierarchical, to me.


    Expecting help for all these four above.

    Thanks,
    -Aarsh

  5. Kevin
    Kevin avatar
    22 posts
    Member since:
    Mar 2012

    Posted 22 Oct 2012 Link to this post

    I have the same problem.  I have a dept report I have to build that will require data from multiple databases. I am well versed in Crystal Reports but am fairly new to Telerik Reporting.  Does this still need to be done using sub reports? Is it still true that there is only one datsource per report?

    Thanks!
  6. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 23 Oct 2012 Link to this post

    10 days and still no reaction from telerik and their so called the best support :-/
  7. Elian
    Admin
    Elian avatar
    435 posts

    Posted 25 Oct 2012 Link to this post

    Hello Aarsh,

    Up to your questions:
    1. You can use a Table item which is a data item and can be bound to a single data source. You can have multiple tables in one report and each of them will have its own DataSource
    2. The default style for the parameter editor with multiple selection (a Multi-Value parameter) is a checkbox list and the drop-down list is the default style for the parameters which have AvailableValues set. 
    3. Only one DataSource per item is allowed. The report may contain several data source components but it will take its data from the one that is set to its DataSource property.
    4. Check the following article: How to: Bind to a DataSet

    Kevin, 
    Yes, there is still one DataSource per report. You can programmatically merge your data-sources or use different items that support data-binding (Table/Crosstab/List), depending on your scenario.

    Regards,
    Elian
    the Telerik team

    HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

  8. Kevin
    Kevin avatar
    22 posts
    Member since:
    Mar 2012

    Posted 25 Oct 2012 Link to this post

    Elian,

    Thanks for your reply, but I need more info.  I now have multiple tables in sub report containers in my master report.  However I need to take pieces of data from the different tables in the sub reports and do calculations with them.  I cannot figure out how to tie pieces of data from different tables together in the master report. Does this need to be done in the code behind?  Is there a way to do it using the expression editor?  

    Thanks!
  9. Ed Lance
    Ed Lance avatar
    61 posts
    Member since:
    Jun 2012

    Posted 26 Oct 2012 Link to this post

    Kevin,
    The way I bring different tables together is with joins in SQL.  In SQL Server there are a couple of options for bringing together multiiple databases depending on whether they are on the same server or not.  I always try to get that done in the database side because, #1, I am a database guy, and #2, it helps simplify the report because it doesn't need to be 'aware' of the business of multiple databases.
  10. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 29 Oct 2012 Link to this post

    @Kevin, I think you are right. I actually have been migrated from other reporting package, and they allowed multiple datasets and multiple datasource. In their terminology, datasource is database actually, and dataset might be multiple queries, SPs on the same datasource.

    Now let's come to telerik reporting style. They are having just different  scenario. And I've got few work arounds

    1. (Case # 1) You want to display two tables from two different datasets on the same report - use two subreports and deploy them in a single report. Pass the parameters from the main report.
    2. Follow this scenario until you reach to the stage when you have to use just one data set for one report.
    3. (Case # 2) You need to flourish multiple parameters from database query, for example, in the context of N.W. db, say you want to populate the products, categories and suppliers - no problem , declare a report parameter and use the 'available values' section for binding the parameter to the database.

    If you are having different scenario , please post.

    hth

    Thanks,
    -Aarsh

  11. Elian
    Admin
    Elian avatar
    435 posts

    Posted 30 Oct 2012 Link to this post

    Hello Kevin,

    There isn't a straight-forward approach to this. Basically, it is best to built your reports in such a manner that you won't need to get data from SubReports into master reports. However, you might listen for the DataBound event of the SubReport item and get the processing table elements from there. 
     
    Regards,
    Elian
    the Telerik team

    HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

  12. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 09 Mar 2013 Link to this post

    Since this is a fairly recent thread on this topic I'd like to piggyback here. I think my example is similar to what people are asking here and should translate easily to applications by other folks.

    I have an ObjectDataSource with a Product table and another one with a Vendor table. The report is based on Product. Each product has a VendorId field. In a query that would be joined to get Vendor.Name, or in code perhaps:
    string vendorName = colVendors[ product.VendorId ].Name

    So in a report, I just want to find out who I get product froms, with detail like:
    ProductID, Description, VendorName, VendorContactName, VendorContactPhone, ...

    Can we do something like that with Reporting? Or does each ObjectDataSource need to have the complete set of data required to satisfy all possible requests? That can be cumbersome. At the very least it's not elegant because it violates separation of concerns by requiring data sources which match the UI.

    What if the ObjectDataSource is a DataSet with multiple tables? What then would be the syntax for relating the Product.VendorId to the related Vendor record and its Name property?

    My goal is to create a collection of well-defined singular and collection classes, expose these via an assembly, then provide this to end-users along with the stand-alone designer. With this, they should be able to choose data sources from the assembly to build their own reports. I can't predict every possible preferred join, but with a strong schema to relate the various classes, I'm hoping "hooks" in the environment will allow users to relate fields from various sources. Am I asking too much out of this at the moment? Is support for this in the pipeline?

    And relating my points above, in this assembly that I provide, is it better to provide singular and collection classes, or DataSets with DataTables, customized for predictable report types?

    Thanks!
  13. Ed Lance
    Ed Lance avatar
    61 posts
    Member since:
    Jun 2012

    Posted 11 Mar 2013 Link to this post

    So much easier to get these joins done in SQL....

    In the case of trying to provide something generic, my experience has been that users will not invest much into figuring out how the entities are joined.  So in that scenario I would provide a data source supplied by a view that joined together Products and Vendors.  That way an end user could pick the fields they want and not have to worry about dealing with underlying IDs. 
  14. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 11 Mar 2013 Link to this post

    Thanks Ed, I'm inclined to agree. I experimented with this over the last couple days and found another show-stopper for the approach using DataTables and class objects. Assume you provide a full set of schema for user selection.They only select 2 fields and do a preview. This isn't a query for fields, the data being returned is a full class object, regardless of how many fields are being used. Performance goes down the tube as potentially every field from every record is pulled from the database  - with every field except the couple requested getting discarded on the client side.

    For my next trick... I've created a DataObjectMethod which can be used to return different schema at design and runtime. At design time the full schema (and no data) is returned for a subset of tables. The fields are given proper names as "tableName.fieldName". For runtime with data access, I'm about to look into what can be done to send a list of fields into a parameter of the DataObjectMethod, so that the data returned only has the desired fields. I don't have a lot of faith for doing this anytime soon for a real end-user offering. I already foresee too many gotchas. But this is an interesting exercise.

    If anyone knows of a parameter which can be built at report time and passed to the database, containing a list of all required fields, please let me know. I will post a separate thread if I don't see a response here. I'm guessing this can be done with code by iterating through all of the textBox controls, but fields are used elsewhere as well, like filters, parameters, groups, etc. I'm hoping there is a collection on a Report class that lists all required fields.

    Thanks again.
  15. KS
    KS avatar
    165 posts
    Member since:
    Oct 2012

    Posted 13 Mar 2013 Link to this post

    Not sure if you are looking exactly for that, but here is posted a project with dynamic creation of data based on parameters http://www.telerik.com/community/forums/reporting/telerik-reporting/dynamic-table-columns.aspx

  16. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 13 Mar 2013 Link to this post

    @Sinderella Thank you very much. Will check it.
Back to Top
DevCraft banner