Dynamic Reports with Telerik (Silverlight4 – Part 2)

We have been work hard to get running with dynamic reports. I admit that Telerik solution for report is pretty cool.

There were are following options to get our work going:

  1. Make use of “Table” API in Telerik Report
  2. Simple approach of making fields and align them properly

Option 1, failed to great extent in terms of loading heavy amounts of data. (1600 rows, between is not heavy). Researched on it today and submitted ticket to telerik 448457. With that i hope they fix the issue of table rendering. There is something seriously wrong with their approach.

That being said, i really like the support they give to people for their solution, help system and follow-ups are quite good. With Video tutorials – it makes life easier when you get stuck into some problem.

Now, we went for other (simpler) approach.

Rough flow of information through the silverlight application

Silverlight -> WCF (ReportService.svc) -> Report_NeedDataSource -> Build Report Columns, and provide the data source itself.

Now, Passing information of the context, connection string and running or making query for report posts lot of questions

  1. Security
  2. How to pass back and forth
  3. Fields to display

With that in mind, we used simple parameter passing with some token that tells us where to look for information. This allow us to not send any connection string infomation though the wire.

// important

((System.ComponentModel.ISupportInitialize)(report)).BeginInit();

//get details section, you can get name of the detail section by looking at definition of

//InitializeComponent

DetailSection detailSection = report.Items[“detail”] as DetailSection;

//set height

detailSection.Height = Unit.Inch(0.2);

String[] fields = ….

foreach (String fld in fields)

{

//Fields

Telerik.Reporting.TextBox numberTextBox = new Telerik.Reporting.TextBox();

Telerik.Reporting.TextBox grpHeaderLabel = new Telerik.Reporting.TextBox();

numberTextBox.Left = Telerik.Reporting.Drawing.Unit.Inch(counter);

grpHeaderLabel.Left = Telerik.Reporting.Drawing.Unit.Inch(counter);

//Your Logic for alignment or any other goes here…

//Add them to respective sections

detailSection.Items.Add(numberTextBox);

grp.GroupHeader.Items.Add(grpHeaderLabel);

counter += 1D;

}

//Make Data Source

Telerik.Reporting.SqlDataSource dataSource = new Telerik.Reporting.SqlDataSource();

//connection code goes here…

//select query

dataSource.SelectCommand = “Select fields from table “;

report.DataSource = dataSource;

//pretty important

((System.ComponentModel.ISupportInitialize)(report)).EndInit();

Ok, thats all you need to do.

Note: Create a Blank Report for Telerik.Reporting and then write code in there.

Thanks,

Dynamic Telerik Reports in Silverlight

Guys,
We are going to start working on the dynamic report building thorugh telerik today. It will be a complete dynamic engine with flexibility to user to define following:

  1. Header
  2. Footer
  3. Column/ Fields that needs to be in the report
  4. Formatting Based on Type of Fields

going to take help from http://www.telerik.com/help/reporting/programmatic-control-of-reports.html, and will keep you people posted.

Keep hitting…