New to Reporting, need help...

7 posts, 0 answers
  1. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 19 Mar Link to this post

    Hi All,

    Please bear with me, as I am new to this :).

     

    I am developing a WindowsForm C# application using Telerik controls and I have progressed far enough that I am needing to now do the reports section.

    1. Is there a video tutorial to go through on how to create Reports?
    2. Some of my reports are essentially a form that I just fill data into, can I use Reporting for this too?
    3. The data I generate on the fly, there is no configured data source binding within the WindowsForm application.
    4. I generally have a "print to screen" button to display the data in a popup window and then I can generate the report from this popup (or just print it directly without the popup - would it be better to create the report and use a viewer to show it for the "print to screen" option.
    5. Can the reports be exported to PDF or other applications?
    6. The database is a Microsoft SQL database.

     

    Can someone please guide me in the right direction?

     

    Thanks in advance.

    Damien

     

  2. Todor
    Admin
    Todor avatar
    175 posts

    Posted 22 Mar Link to this post

    Hi Damien,

    Addressing your questions one by one:

    1. I suggest you to start with the Getting Started with Telerik Reporting video. It explains the basics in creating Telerik Reporting Report, and how to create and use an Html5 Report Viewer. There are some differences with the Windows Forms Report Viewer (for example in the latter you can choose Embedded Service instead of a REST Service), but most of the information is applicable for all the Report Viewers we provide.

    2. The form (report definition) can be created using our Standalone Report Designer or Visual Studio Report Designer, and then re-used with different data. You can create also report templates to be re-used for creating similar report definitions.

    3. The data to fill the report with can be supplied from multiple data sources through our dedicated Data Source components. The SqlDataSource component can be configured to use different databases (including Microsoft SQL), and gets the data directly from the database (no extra data mapping/binding necessary in the code).

    4. I suggest to use our Report Viewers for displaying, printing and exporting the reports. You can check how our Windows Forms Report Viewer works. You can also print or export a report programmatically directly from your application by using the ReportProcessor.

    5. Reports can be exported in multiple formats, including PDF - check supported Rendering Extensions.

    6. Microsoft SQL database is supported out of the box - check also the 3rd point.

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 22 Mar in reply to Todor Link to this post

    Thanks for your reply Todor, I was going to submit a support ticket as I hadn't received a response :).

    I understand that SQL is supported, what I am wanting to know is do I need to set the data source in the template, as I will not have control over server names, etc. once deployed to an end user's system? I am converting an old app written in AS3 Flex and the reports I manually created on the fly, grabbing the data into variables and then outputting that to my report in code creating the layout, etc.

    I love the idea of this was, as the user will have much more flexibility with the report, so I will go through what you have sent me, hopefully, I haven't wasted funds on buying the bundled option and I can easily use this component, as it would be easier.

     

    thanks.

  4. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 22 Mar in reply to Todor Link to this post

    FYI

     

    I added a Report Viewer Form and for testing just selected the SampleReport, two things...

     

    1. If I set the Form to start in the position "CenterParent" it is actually not doing that, vertically yes, horizontally no. The CenterScreen one works fine, but I have forms centered on the application, in case the user is using multiple screens.

    2. Do I need to create a Viewer Form for each report I create, or is it one form, multiple templates, and I call the necessary template when I load the Viewer?

     

    Thanks.

  5. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 23 Mar Link to this post

    Okay, I have spent an entire day on this and at the end have nothing to show for it other than less hair on my head than I did this morning.

     

    I want to send the SQL Connection String and SQL Statement to the form for it then to create the report, but I can't seem to pass anything to it the way I have tried so far.

     

    I have followed as much as I can from what you have provided (even though they relate to other solutions), but there does not appear to be an example that is relevant to what I am trying to do and the more I try and fail, the more frustrating this is becoming.

     

    I have added a ReportViewerForm and it has created the sample trdp file, but I want this as something that is embedded in the application and I can't seem to be able to select this option, only the file itself if it is copied to the bin folder when built. I have tried to add a parameter and have the value sent from my application, but that also doesn't work.

     

    This is the code I have that opens the viewer (which has a location bug by the way - setting it to CenterParent doesn't actually center it on the parent as it should)...

    var uriReportSource = new Telerik.Reporting.UriReportSource();
    uriReportSource.Uri = "Reports\\AgedPacket.trdp";
    uriReportSource.Parameters.Add(new Telerik.Reporting.Parameter("Date", DateTime.Today.ToString("dd/MM/yyyy")));
    ReportViewerForm rvf = new ReportViewerForm();
    rvf.Text = this.Text;
    rvf.reportViewer1.ReportSource = uriReportSource;
    rvf.Show();
  6. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 23 Mar in reply to Damien Link to this post

    I am also trying to restrict the export/save options to PDF, Excel and Word - how do I do this?

     

    thanks.

  7. Todor
    Admin
    Todor avatar
    175 posts

    Posted 27 Mar Link to this post

    Hi Damien,

    I will address the questions one by one:

    Concerning the SqlDataSource, it is indeed recommended to set it in the report definition, i.e. in Design Time.
    There are some options that provide flexibility though:
    1. Use a named connection string stored in the application configuration file (check Connecting the SqlDataSource component to a Data Source article) to connect to different databases based on the user/client.
    2. Use the NeedDataSource event to connect data run time (check Using the NeedDataSource event to connect data article).
    3. It is possible to modify the connection string dynamically, as elaborated in the Changing the connection string dynamically according to runtime data KB article, although we do NOT recommend this approach.

    A single Report Viewer can be used to display multiple reports one by one. You can use also a ReportBook to combine multiple reports.

    The Visual Studio report (C# or VB class) is an alternative of Standalone designer report (.trdp). We suggest using the VS Report Designer to create such report definitions. The VS Designer report inherits Telerik.Reporting.Report, and could be part of a VS application.

    The recommended approach to set SQL Connection String and SQL Statement is by using the corresponding properties of the SqlDataSource in the report definition.

    The report parameters should also be created in the report definition. Only their values could be passed from the report viewer, i.e. a new Report Parameter cannot be added to the report from the form viewer.
    In the context of the provided code snippet, if the report 'AgedPacket.trdp' contains a report parameter named 'Date', its value should be assigned with this code.
    Refreshing the report might be necessary (call reportViewer1.RefreshReport()).

    You can check how to restrict the export options in the Limit export options in ReportViewer to certain format only KB article.

    We have already answered the question concerning CenterParent in the support ticket (1159421) you opened on the issue. I will copy the answer here so that other community members could also benefit from it:

    Depending on the type of the application you have, there can be two ways to center the child. If you have MDI application, set MdiParent property of the child form:

    Form f2 = new Form() { Width = 400, Height = 300 };
    f2.StartPosition = FormStartPosition.CenterParent;
    f2.MdiParent = f1;
    f2.Show();

    If the application is not MDI call ShowDialog method using parent form as the parameter:

    Form f2 = new Form() { Width = 400, Height = 300 };
    f2.StartPosition = FormStartPosition.CenterParent;
    f2.Show(f1);

    Based on this stackoverflow discussion:
    "CenterParent does not work correctly with Show since there is no way to set the Parent, so if ShowDialog is not appropriate, the manual approach is the only viable one:

    Form2_Load(object sender, EventArgs e)
    {
        if (Owner != null)
            Location = new Point(Owner.Location.X + Owner.Width / 2 - Width / 2,
                Owner.Location.Y + Owner.Height / 2 - Height / 2);
    }
    "

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top