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

HTML5 Report Viewer reportSource parameter.

13 Answers 1131 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shanker
Top achievements
Rank 1
Shanker asked on 11 Jun 2014, 11:34 AM
I have a class library project named AssetProReport
which has Report1 file.

$("#reportViewer1")
            .telerik_ReportViewer({
                serviceUrl: "api/report/",
                templateUrl: '/ReportViewer/templates/telerikReportViewerTemplate.html', 
                reportSource: { 
                    report: "AssetProReport.Report1, AssetProReport.Report1",
                    parameters: {
                        CultureID: "en"
                    }
                }
});

Error.
Unable to get report parameters:
Report 'AssetProReport.Report1, AssetProReport.Report1' cannot be resolved.



13 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 13 Jun 2014, 12:22 PM
Hello Shanker,

Please check the following:
  1. The reports and the viewer's projects use the same Telerik Reporting version. For the purpose you can run the Upgrade Wizard to verify this;
  2. The reports' project assembly is referenced in the viewer's project;
  3. The assembly qualified name of the report is spelled correctly: <namespace>.<report_name>, <assembly_name> (the name is case sensitive). Most probably the aassembly qualified name in your case is "AssetProReport.Report1, AssetProReport"
  4. Check the parameters added in the report, and verify the passed at values conform the specified type for each. If you need parameters to have null values, check the AllowNull property of each parameter in the report. For more details check Report Parameters. The parameters values passed from the viewer are mapped to the added report parameters by name.

Details about passing report parameters' values through the HTML5 Report Viewer are available in the How To: Pass values to report parameters article.

To check what is the reason for errors with the HTML5 Report Viewer, you can use Fiddler and check the Raw Response text in the Inspectors tab after selecting the failed request.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Fridli Jacober
Top achievements
Rank 1
answered on 19 Dec 2014, 02:13 PM
Hello Steff

What if the report doesn't expect report parameters itself but the report's constructor expects parameters?
up to now the reports where shown programmatically (bla=new ReportingLib.ReportXY(Param1, Param2)).

Thanks and regards
0
Stef
Telerik team
answered on 22 Dec 2014, 03:14 PM
Hi Fridli,

The client (viewer) sends request with a string description of the needed report. This string description is resolved to a valid report in the service's CreateReportResolver method.

If you are using the default report resolver working with assembly qualified names (ReporttypeResolver), the reporting engine will create a report instance via reflection by using the default parameterless type's constructor.
To use another constructor you will have to use a custom report resolver, in which Resolve method you can create an instance of the needed report with any of its available constructors.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Fridli Jacober
Top achievements
Rank 1
answered on 23 Dec 2014, 10:00 AM
Hello Stef

I tried so according to the example you provided to me.
But now VS sais "Error 1 Operator '=' is not defined for types 'Telerik.Reporting.IReportDocument' and 'ReportingLib.BesoldungADFKontoauszug'. C:\Users\fh\Documents\Visual Studio 2013\Projects\HTML5-Report Viewer\HTML5-Report Viewer\Models\LegacyReportResolver.vb 13 16 HTML5-Report Viewer".
The report inherits from "Telerik.Reporting.Report" which itself inherits from "IReportDocument" so I don't understand why it doesn't work and the Report.Designer.vb does exactly the same... 

Public Class LegacyReportResolver
    Implements Telerik.Reporting.Services.Engine.IReportResolver
 
    Public Function Resolve(reportId As String) As Telerik.Reporting.ReportSource Implements Telerik.Reporting.Services.Engine.IReportResolver.Resolve
        Dim ReportSource As New Telerik.Reporting.InstanceReportSource()
 
        'CType(Report, System.ComponentModel.ISupportInitialize).BeginInit()
 
        Return ReportSource.ReportDocument = New ReportingLib.BesoldungADFKontoauszug("", "", "1.1.2012", "31.12.2012")
 
        'CType(Report, System.ComponentModel.ISupportInitialize).EndInit()
    End Function
End Class


Btw: Is there a possibility to convert VB reports to XML reports?

Thx

0
Fridli Jacober
Top achievements
Rank 1
answered on 23 Dec 2014, 10:53 AM
Hello Stef

You can forget about the last post and delete it. Was a copy&paste mistake which I saw too late.

Two questions left atm:
- Is there a possibility to convert VB reports to XML reports?
- Is it possible to use a report parameter not only as SQL-Variables (@...) but for example as column name in a query too or similar stuff?
  Or other question: How to make a "dynamic" SQL query in a XML report where you can't have logic in a constructor to build a custom query e.g. based on custom constructor parameters?

Thx & regards

Thx & regards
0
Fridli Jacober
Top achievements
Rank 1
answered on 23 Dec 2014, 11:00 AM
p.s. and how to pass such parameters like database column names to a report without a custom c'tor since the ReportParameters collection seem to be not yet initialized in the report's c'tor...

thx
0
Fridli Jacober
Top achievements
Rank 1
answered on 23 Dec 2014, 11:21 AM
p.p.s. is it possible to pass custom data from the viewer to the report controller or to the report itself?

thx
0
Stef
Telerik team
answered on 25 Dec 2014, 01:48 PM
Hello Fridli,

The reporting SqlDataSource component uses standard ADO.NET classes and the installed on the machine data providers to retrieve data from a SQL database. Thus you can build a dynamic SQL query with nvarchar parameters, or use a standard SQL query with WHERE clause and parameters. On configuring the SqlDataSource component the SQL parameters can be mapped to report parameters (check the supported types).

The report must be designed with the fields' names available in the data retrieved for the report.


Already existing reports in Vs can be converted to XML (TRDX) files via ReportXmlSerializer or the Import Report Wizard of the Standalone Designer. Custom code as additional properties and events will not be serialized.

To provide you more accurate suggestions, please elaborate on the scenario and the report you are generating. Post also the code executed in the ReportingLib.BesoldungADFKontoauszug method and the report's code.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Fridli Jacober
Top achievements
Rank 1
answered on 08 Jan 2015, 04:52 PM
Hello steff

First thanks!

But im not sure if we understand each other correctly with the sql query. I'll have a further look on it and maybe come back to this.

But what about the custom report resolver problem?

"I tried so according to the example you provided to me.
But now VS sais "Error 1 Operator '=' is not defined for types 'Telerik.Reporting.IReportDocument' and 'ReportingLib.BesoldungADFKontoauszug'. C:\Users\fh\Documents\Visual Studio 2013\Projects\HTML5-Report Viewer\HTML5-Report Viewer\Models\LegacyReportResolver.vb 13 16 HTML5-Report Viewer".
The report "BesoldungADFKontoauszug" inherits from "Telerik.Reporting.Report" which itself inherits from "IReportDocument" so I don't understand why it doesn't work and the Report.Designer.vb does exactly the same... "

Thx
0
Nasko
Telerik team
answered on 13 Jan 2015, 12:42 PM
Hello Fridli Jacober,

In the provided help article: How To: Implement a Custom Report Resolver, the custom report resolver method returns a Report Source:
...
    Dim reportSource As New Telerik.Reporting.XmlReportSource()
    reportSource.Xml = reportXml
    Return reportSource
End Function

In your code you are trying to return a ReportSource.ReportDocument:
...
Return ReportSource.ReportDocument = New ReportingLib.BesoldungADFKontoauszug("", "", "1.1.2012", "31.12.2012")
...

which is not correct, since the method is declared to return a Telerik.Reporting.ReportSource.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Fridli Jacober
Top achievements
Rank 1
answered on 14 Apr 2015, 01:31 PM

Hello Nasko

Thanks for your answer.

 

As I mentioned above it was a copy&paste mistake which I noticed too late.

 

Regards

0
Fridli Jacober
Top achievements
Rank 1
answered on 06 Oct 2015, 08:29 AM

Hi Stef

Could you make an example of your "dynamic" SQL query?
What I wanted to do is something like e. g.: SELECT @MyCustomColumns FROM @MyCustomTable WHERE @MyCustomWhereClause

Thank you!

0
Stef
Telerik team
answered on 08 Oct 2015, 12:59 PM
Hi Fridli,

Please check the following articles elaborating on dynamic SQL queries:

I hope this helps you.

Regards,
Stef
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
Tags
General Discussions
Asked by
Shanker
Top achievements
Rank 1
Answers by
Stef
Telerik team
Fridli Jacober
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or