Report Book help needed

8 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 12 Oct 2009 Link to this post

    Hi

    I'm trying to get multiple reports to display in a ReportBook control.

    Each report uses the same parameter (JobPlan_ID) but I cant see there the ReportBook merges the params and where I can set them.

    I am trying the approach shown below, but I keep getting Object reference not set errors on the line assigning the paramter.

    Dim reportBook As ReportBook = TryCast(Me.ReportViewer.Report, ReportBook)

    Dim
    Frontsheet_Report As New JobPlan_Frontsheet()
    Frontsheet_Report.ReportParameters(
    "JobPlan_ID").Value = Session("Jobplan_ID")
    reportBook.Reports.Add(Frontsheet_Report)

    Dim
    Notes_Report As New JobPlan_Notes()
    Notes_Report.ReportParameters(
    "JobPlan_ID").Value = Session("Jobplan_ID")

    reportBook.Reports.Add(Notes_Report)

     
    I have gone through the help files and searched the site for Reportbook, and none of the examples quite fits.

    Andy

  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 13 Oct 2009 Link to this post

    Hi Andy Green,

    The Report property of the report expects Telerik.Reporting.IReportDocument which can be either a report book or a single report. If you receive null reference exceptions in the reportBook.Reports.Add() method, then most likely the ReportViewer is not bound to a ReportBook and returns single report. Debug your code carefully and see where does the error occur exactly.

    All the best,
    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.
  3. DevCraft banner
  4. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 14 Oct 2009 Link to this post

    The problem was this line:
    Dim reportBook As ReportBook = TryCast(Me.ReportViewer.Report, ReportBook)
    the value of reportBook was null, and I couldn't get it to work.

    I've gone away from trying to create this in code behind, and I have now created it all in markup.

    My report book now shows all my reports, but they are empty, how do I get my parameters into the reports, and how does the report book control merge the params into 1 set.

    Each report has properties to set the param value as:

     

     
        Public Property JobPlan_ID() As Int32  
            Get  
                Return _JobPlan_ID  
            End Get  
            Set(ByVal Value As Int32)  
                _JobPlan_ID = Value 
            End Set  
        End Property 

     



    ANdy
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 14 Oct 2009 Link to this post

    Hi Andy,

    Our advise is to review the ReportBook documentation that elaborates on how it works and also review our ReportBook demo report to see how it is implemented.

    Greetings,
    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. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 15 Oct 2009 Link to this post

    I've gone through chunks of the docs again, and what is apparent is that most of what I want to do you only show examples with a built in datasource, I'm having to use a dataclass.

    Unfortunately your examples dont show how to link the reportbook to a report with properties, or if it does I'm missing it.

    This senario might be shown in the videos, but I cant view them, it's our web rules block all web media - yours included.

    Thanks for your help till now, but it looks like I'm going to have to re think how I do this.

    Andy

  7. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 15 Oct 2009 Link to this post

    Hello Andy,

    The type of datasource you use to bind the report or the way you bind the report is not relevant (as long as the datasource is supported) in this case. The way you set the values for the report parameters is not relevant either and whether report parameters from two or more reports would be combined in a report book depends entirely on the Name and Type of the params. If they are the same, then they are considered equivalent and are displayed as a single parameter. So if we have to answer your question directly:

    My report book now shows all my reports, but they are empty, how do I get my parameters into the reports, and how does the report book control merge the params into 1 set.

    The reportBook would simply combine the reports into one IReportDocument and if the reports are empty, then their counterpart in the report book would be empty as well. You get the report parameters into the reportBook by simply having the parameters in your regular reports. I've explained the merging in the first paragraph.

    Sincerely yours,
    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.
  8. Andy Green
    Andy Green avatar
    120 posts
    Member since:
    Jul 2009

    Posted 16 Oct 2009 Link to this post

    Thanks Steve

    My problem is that I dont have parameters declared in my reports, I'm passing the parm in the code behind, that is why its not available.

        Private Sub JobPlan_Frontsheet_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.NeedDataSource  
     
            Dim fs As New CPSMDAL.JobPlan  
            Dim fsDT As DataTable = fs.JobPlanReport_Frontsheet(Job_Plan_ID)  
            TryCast(sender, Telerik.Reporting.Processing.Report).DataSource = fsDT 
     
        End Sub 

    I guess this is the wrong approach. I think the way forward (unless you have any better ideas) is to add datasources to the reports and do it that way ignoring the data classes, the downside is that this data access will be different to the rest of the site (and every other app we support)

    Andy
  9. saba homa
    saba homa avatar
    1 posts
    Member since:
    Jan 2010

    Posted 11 Jan 2010 Link to this post

    Hi Steve,
    Could you please help me,I am trying to learn Telerik Reporting.But I can not use from storedprocedure.
    I can not bind database fields to chart too.
    Regards,
                 Saba
Back to Top
DevCraft banner