This is a migrated thread and some comments may be shown as answers.

using complex object as data source

3 Answers 132 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
rafi
Top achievements
Rank 1
rafi asked on 26 Sep 2010, 03:25 AM
Is there any way that i can use the below mentioned business object to generate the report  ?

public class PriliminaryReport {
        public Practitioner Practitioner { get; set; }
        public Patient Patient { get; set; }
        public IEnumerable<Score> Scores { get; set; }
        public long TotalScore { get { return Scores.Select(x => x.SecScore).Sum(); } }
    }


This is a report which contains the patient's Score .

i want patient,practitioner details and section wise score of the patient .

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Sep 2010, 11:56 AM
Hello rafi,

Please take a look at the following thread for more information on your inquiry.

Greetings,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
rafi
Top achievements
Rank 1
answered on 27 Sep 2010, 06:10 PM
hi steve,

Thanks a lot for your wonderful support .   i tried the sample code you mentioned in the other post with my business  object.
But i could not get it worked . i am totally new to this reporting stuff . And my client want only this reporting mechanisam.

i have attached the code . i was trying on my own by seeing the videos. Can you please go through it
And help me get it worked .

Basically i need a report generated with the patient , practitioner details and the patients score as a table.
in my code i was able to show the patient and the practitioner details but not able to show the Scores .

please help me with this.

If you can mention any relevant videos and document , that would be a great help.

using System.Collections.Generic;
 
namespace MyReports {
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;
 
    /// <summary>
    /// Summary description for PriliminaryReport.
    /// </summary>
    public partial class PriliminaryReport : Telerik.Reporting.Report {
        public PriliminaryReport() {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();
 
            var list = new List<Score>();
            list.Add(new Score { SectionId = 1, SecScore = 6 });
            list.Add(new Score { SectionId = 2, SecScore = 5 });
            list.Add(new Score { SectionId = 3, SecScore = 4 });
 
            var report = new PriliminaryPatientReport
            {
                Patient = new Patient
                {
                    FirstName = "ravi",
                    LastName = "k",
 
                },
                Scores = list,
                Practitioner = new Practitioner
                {
                    FirstName = "prabhat",
                    LastName = "p",
                }
            };
 
            this.DataSource = report;
 
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
    }
 
    public class Score {
        public int SectionId { get; set; }
        public int SecScore { get; set; }
    }
 
    public class Patient {
        public string FirstName { get; set; }
        public string LastName { get; set; }
 
    }
 
    public class Practitioner {
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
 
    public class PriliminaryPatientReport {
        public Patient Patient { get; set; }
        public Practitioner Practitioner { get; set; }
        public IEnumerable<Score> Scores { get; set; }
    }
}

and attached are the designer and preview screen shots.
0
Steve
Telerik team
answered on 30 Sep 2010, 02:38 PM
Hi Rafi,

The topic I've referenced contains details instructions and a sample report. Probably you've missed the fact that you should use the Bindings property of the Table item to bind it to data? Please review the provided sample project and if you're still having problems, let us know.

Greetings,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
rafi
Top achievements
Rank 1
Answers by
Steve
Telerik team
rafi
Top achievements
Rank 1
Share this question
or