Telerik Forums
Reporting Forum
7 answers
1.1K+ views

Hello, We have working HTML5 Report viewer with back-end WCF servics. 

Now , we are looking for additional step ahead where we can generate the report programmatically and send it over as email attachment.

I have followed the article "Exporting Report Programmatically" & able to create the report programmatically, however when I am assigning the data to report source it goes as NULL.
            ReportViewer1.ReportSource = reportSource;

The serveic returns valid data in Telerik.Reporting.ObjectDataSource but it goes as NULL while assigning it to Report viewer. 
Any thoughts, what could be wrong here ?

topSpendersDataList = BusinessManager.GetTopSpenders();
 
      Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
      objectDataSource.DataSource = topSpendersDataList; // GetData returns a DataSet with three tables
      objectDataSource.DataMember = "GetTopSpenders"; // Indicating the exact table to bind to. If the DataMember is not specified the first data table will be used.
            objectDataSource.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("FirstName", typeof(string), "=Fields.firstName")); // Adding a sample calculated field.
            objectDataSource.CalculatedFields.Add(new Telerik.Reporting.CalculatedField("LastName", typeof(string), "=Fields.lastName"));
 
            // Creating a new report
            Telerik.Reporting.Report report = new Telerik.Reporting.Report();
 
            // Assigning the ObjectDataSource component to the DataSource property of the report.
            report.DataSource = objectDataSource;
 
            // Use the InstanceReportSource to pass the report to the viewer for displaying
            Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
            reportSource.ReportDocument = report;
 
            // Assigning the report to the report viewer.
            ReportViewer1.ReportSource = reportSource;

Thanks,

Nitin

Stef
Telerik team
 answered on 12 Jun 2015
2 answers
522 views

Hi, I created a report that gas one group. The data has the following form:

OrderID | Date | OrderTotal | InvoiceID | InvoiceTotal

1 | 2015-01-01 | 300 | 1 | 150

1 | 2015-01-01 | 300 | 2 | 100

1 | 2015-01-01 | 300 | 3 | 50

 

The report groups on OrderID, so on the group header I have the info related to the order and on the detail section I have the info related to the invoices for each order. The group footer has a subtotal for the InvoicoTotal (this works fine. Returns value of 300). In the report footer I have a total for OrderTotal, and teh prblem here is that the value I am getting is 900 instead of 300. How can I achieve to sum on the group level and not on the detail level. I have already tried using Exec(scope, SUM) and RunningTotal(scope, SUM) but the result is the same.

Javier Gonzalez de Aragon
Top achievements
Rank 2
 answered on 12 Jun 2015
2 answers
486 views

I am using Telerik Report Designer, and I have a report that has many nested subreports. The report works fine, but I am trying to change one subreport based on user input.  I attempted to do this by adding a Binding to ReportSource like this:

 

= IIf(Parameters.Images.Value,"ShowImages.trdx", "NoImage.trdx")

When I run this I get the error

 

I've tried different variations of the Expression, including the full path of the trdx file,  but get the same error. Is there a way to change which file is referenced?

 

Thanks,

Tracy

Tracy
Top achievements
Rank 1
 answered on 11 Jun 2015
1 answer
332 views

I am having an issue getting my report to layout correctly.

Each item in the report has a header and a body textbox.

I have it set to layout 2 items per page. But if the body textbox grows beyond its initial size I need it to set PageBreak to beforeandafter to isolate the report.

I tried putting a binding on the main section, but am not able to access the body textbox properties in it.

Is there another way this can be accomplished?

Stef
Telerik team
 answered on 11 Jun 2015
5 answers
1.2K+ views
I downloaded source code for Telerik RESTful Reporting Service and Consuming Telerik Rest Service update my Nuget Packages to enable CORS and still I have this Error Creating report instance. Do you know what might be the cause of this? Thanks



Stef
Telerik team
 answered on 11 Jun 2015
1 answer
223 views

What is the recommended way to access properties and methods on a report class from a report viewer?

For example:

MyReportBase :  Telerik.Reporting.Report

public string ReportTitle

public string GetNumberOfRecords() 

 

MyReportClass : MyReportBase

 

Form MyReportViewer has a radReportViewer control on it.

Suppose I want my form to set it's title to be myReport.ReportTitle + " - " + myReport.GetNumberOfRecords() + "records"

eg Client List - 127 records

The radReportViewer control is using the InstanceReportSource type for the report source. 

 

 

 

Stef
Telerik team
 answered on 11 Jun 2015
1 answer
301 views

I am trying to print Telerik report (.trdx) directly to the printer using MVC.

 

Please let me know the solution.

Stef
Telerik team
 answered on 11 Jun 2015
2 answers
235 views

I get error message in html5 report viewer "Internal Server Error: undefined" after I update my project to .Net Framework 4.5.2 and update Microsoft.AspNet.WebApi to version 5.2.3.

Now I'm using Telerik reporting Q3 2014 8.2.14.1027

 

Stef
Telerik team
 answered on 10 Jun 2015
3 answers
555 views

Hello!
I'm currently upgrading Telerik reporting in my application from version 5.1.11.928 to version 8.2.14.1204. I am using Visual Studio 2010, using C#.

 

I'm encountering a problem with a report parameter using a sqlDataSource. At first, I was encountering a problem because an arraylist was being used in a parameter (as an ansistring). This caused an error with XML serialization. So I realized that an arraylist wouldn't work anymore. However, the query its using is relying on accepting a collection of values.
    (e.g. (Where number.ID IN (@ValueType) )

 

I saw that I can change the parameter to accept multiple values from:
    http://www.telerik.com/help/reporting/designing-reports-parameters.html

 

However, I can't seem to get it to work correctly. For some extra context I have also changed the collection to a hashset<int>.
The report parameters are being set with code that uses the reportviewer.
Example:
var genericReport = new GenericReport();
genericReport.ReportParameters["ValueType"].Value = hashValueGenerator("Selector");
//hashValueGenerator returns a hashset of integers based upon its selector
//This used to be an arrayListGenerator

From there, the code would then take the report that was generated and add it to the reportSource. (This part works fine.)
I believe I am setting up my value type incorrectly to accept the new collection I'm creating.

 Here is the parameter as it existed before the upgrade:
    Name: @ValueType
    DbType: AnsiString
    Value: =Parameters.ValueType.Value

 

This is my attempted fix to my problem:
    Name: @ValueType
    DbType: Int32
    Value: //Shown below as created in the Report Parameter Editor
    //Only the bolded (non-default) changes are being displayed
    //Organized to look like pseudocode, but I am using the editor
    //Quotes are for readability, they are not used in the actual editor boxes
Report Parameter{
AvailableValues {
    DataSource = sqlDataSource,
    //The same as shown as the data source on the report designer.
    ValueMember= "=Parameters.ValueType.Value"}
MultiValue= true,
Name= ValueType,
Text= ValueType,
Type= Integer,
Visible= true
}

I get the following error in my Report Viewer: "Missing or invalid parameter value. Please input valid data for all parameters."
Can anyone give me any insight as to what I'm doing wrong?

Thank you very much!

Stef
Telerik team
 answered on 10 Jun 2015
1 answer
394 views

I have a report which I view via a ReportViewer on a web page.  In the viewer, I can choose to export to CVS.  In the resulting CVS file, the headers do not show the names of the header textboxes like I want them to.  Instead, they show the default names that were given to the textboxs when the report was created.

 For instance, initially a header textbox was named "prodOrderDataTextBox" automatically.  In the properties of the textbox, I renamed it to "ProdOrder" and it is this name that I want to appear in the CVS file.

 How can I change this?

Nasko
Telerik team
 answered on 10 Jun 2015
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?