Telerik Forums
Reporting Forum
4 answers
522 views
Hi, I am using Telerik Reporting Q3 2013, and am trying to create a view model in an MVC application to display a report.  I am having an issue using the InstanceReportSource.

This works fine, and the report is displayed as expected (where "Report" in '_model.Report' is a custom class I have created to represent a report, and the parameters I enumerate are also custom classes that represent a report parameter in my report class, where the 'Value' property is a C# dynamic)....
                       
public ReportSource ReportSource
{
    get
    {
        // create the report source for the report
        var reportSource = new TypeReportSource
        {
            TypeName = _model.Report.TypeName + ", " + _model.Report.AssemblyName
        };
  
        // add all report parameters
        foreach (var parameter in _model.Parameters)
        {
            reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
        }
 
        // set a title parameter to the title of the user's report
        reportSource.Parameters.Add("Title", _model.Title);
 
        return reportSource;
    }
}

However, if I switch to using an InstanceReportSource, the report viewer just shows a "bad request" error...
public ReportSource ReportSource
        {
            get
            {
                // create the report source for the report
                var reportSource = new InstanceReportSource
                {
                    ReportDocument = new BidTabReportByStatus()
                };
 
                // add all report parameters
                foreach (var parameter in _model.Parameters)
                {
                    reportSource.Parameters.Add(parameter.Parameter.Name, parameter.Value);
                }
 
                // set a title parameter to the title of the user's report
                reportSource.Parameters.Add("Title", _model.Title);
 
                return reportSource;
            }
        }

In both cases, my view simply loads the report source property from the model...

@{
    // display the report
    @(Html.TelerikReporting().ReportViewer()
          .Id("reportViewer")
          .ServiceUrl("/api/reports/")
          .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html")
          .ReportSource(Model.ReportSource)
          .ViewMode(ViewModes.INTERACTIVE)
          .ScaleMode(ScaleModes.SPECIFIC)
          .Scale(1.0)
          .PersistSession(false))
}

Can you please help me figure out what is going on?  My ultimate goal is to be able to use one report for multiple data sets, by defining a sql command for the report's SqlDataSource 's CommandText property by defining it on the report source, which I can obtain using the instance report source.

Thanks,
Andy
Stef
Telerik team
 answered on 11 Jul 2014
3 answers
279 views
I'm trying to create a simple report with telerik reporting and ASP.NET MVC 4. I have several questions

I have created a sample report by binding to a sql datasource.

my report name is "Report2.cs" but i'm confused about .trdx report (why should i create a .trdx report)?

when trying to bind  the report to report viewer i use the below code.

@{
    ViewBag.Title = "reportview";
    Layout = "~/Views/Shared/_mainView.cshtml";
}

@section styles
{

    <link href="~/Content/ReportViewer/styles/ReportViewer-7.2.13.1016.css" rel="stylesheet" />
    <style>
        #reportViewer1
        {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 5px;
            bottom: 5px;
            overflow: hidden;
        }
    </style>
}

@section scripts
{
    <link href="~/Content/kendo/2013.2.716/kendo.common.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2013.2.716/kendo.blueopal.min.css" rel="stylesheet" />
    <script src="~/Scripts/kendo/2013.2.716/kendo.all.min.js"></script>

    <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
    <script src="~/Content/ReportViewer/js/ReportViewer-7.2.13.1016.js"></script>
    
}

@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        .TemplateUrl("/Content/ReportViewer/templates/telerikReportViewerTemplate.html")
        .ReportSource(new Telerik.Reporting.TypeReportSource() { TypeName = "MvcReportApplication.MyReport.Report2" })
        .ViewMode(Telerik.ReportViewer.Mvc.ViewModes.INTERACTIVE)
        .ScaleMode(Telerik.ReportViewer.Mvc.ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(true)
)

report is not displayed and i get the below error in console

Uncaught TypeError: Cannot call method 'replace' of undefined

Stef
Telerik team
 answered on 11 Jul 2014
2 answers
299 views
I have an MVC4 web application with Razor pages.  The report page uses a UriReportSource for the Telerik ReportViewer.
The cshtml code is:

@model StdPOTOrderPrint
 
 
@{
    var uriRS = new UriReportSource() { Uri = @Model.ReportParms };
}
 
 
@(Html.TelerikReporting().ReportViewer()
    .Id("reportViewer1")
        .ServiceUrl(Url.Content("~/api/reports/"))
        .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate.html"))
        .ReportSource(uriRS)
        .ViewMode(ViewModes.INTERACTIVE)
        .ScaleMode(ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(false)
 
)

 The controller code is:
 
namespace CPR.WebPortal.Controllers
{
    public class ReportsController : ReportsControllerBase
    {
 
        protected override IReportResolver CreateReportResolver()
        {
            return new CustomReportResolver();
        }
 
        protected override ICache CreateCache()
        {
            return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
        }
    }
 
    public class CustomReportResolver : IReportResolver
    {
 
        public Telerik.Reporting.ReportSource Resolve(string reportparms)
        {
            string[] stringSeparators = new string[] {"|"};
            string[] sarray = reportparms.Split(stringSeparators, StringSplitOptions.None);
 
            long patientid = Convert.ToInt64(sarray[0]);
            long orderid = Convert.ToInt64(sarray[1]);
 
            ....
 
            PatientPhysicianOrderStandardPropertyBag orderBag = new PatientPhysicianOrderStandardPropertyBag();
            PatientHelper.Populate(order, orderBag);
 
            PatientPhysicianOrderStandardDataObject _dataSource = new PatientPhysicianOrderStandardDataObject(workContext, orderBag);
 
            Telerik.Reporting.Report report = new DHS.Client.Controllers.Reporting.ReportDefinitions.PatientPhysicianOrderStandardReport();
            report.DataSource = orderBag;
 
            Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
            irs.ReportDocument = report;
 
            return irs;
        }
    }
}

 The problem is that the  Resolve method is not being called, resulting in the reportviewer showing an error of:
 
Unable toget report parameters:
Report '500507|500029' cannot be resolved.

Why is Resolve not being called?
Dan
Dan
Top achievements
Rank 2
 answered on 10 Jul 2014
3 answers
133 views
Hi,

configurable parameters in telerik reporting is a great feature which saves me a lot of time in allowing to avoid coding my own solution.
Actually, when defining a parameter with AllowNull = true on a drop down or date field a checkbox "NULL" apperas near the field. I would rather prefer to have something like "Please select" to be treated as null value on drop downs or nothing entered in the date boxes.

Is there a way to achieve this behavior in telerik reporting?

Regards
Stef
Telerik team
 answered on 10 Jul 2014
1 answer
447 views
Hi

I currently have a report which i created which looks good.

I have a sub report in the report which show a order sent to supplier

I need to add a second page which shows a distribution list but this needs to start on a new page as it has a different layout.
How could i do this
Nasko
Telerik team
 answered on 10 Jul 2014
1 answer
370 views
Hi

I currently have a textbox that calculates the total of two fields
textbox1 =(Fields.qty * Fields.cost)

i want to add a textbox at the end of the group to calculate the sum of textbox1
I have tried

textbox2 = Sum(Textbox1) but i am getting the following error
"An error has occured whil processing 'report1'. the expression contains object 'textbox1'that is not defined in the current context"
Nasko
Telerik team
 answered on 10 Jul 2014
1 answer
110 views
Hi,
      My Report select statement contains the following columns, Pickup time,Enroute,scene,Transport,Destination,Available..
     The Report also showing the same results. But When I export to CSV  it will be showing the following order Pickup time,Transport,Enroute,Destination,Available,
     scene.

     Anybody please suggest a solution for fix this issue...

     Hope u r valuable suggessions...

    Regards
    Manu Vijayan
Stef
Telerik team
 answered on 10 Jul 2014
2 answers
658 views
I am currently testing the trial version of telerik.
I have basic Web based report via WEB API controller that loads a report source.
This report was declared as SQL Data Source.  That works.

However we need to use custom data provider. 
Is there a way of declaring the MetaData and providing a ILIST<Meta> to the report ?

Can the report call a Custom data provider at runtime. ?
Can teh designer call a provider to get meta Data?

I saw a few threads that had similar questions but no obvious answers.

Ideally
A sample in C# with the report engine calling the provider to get Data.  
And how the Report designer is feed the meta data.

Is this possible?
Thanks Phil



Phil
Top achievements
Rank 1
 answered on 09 Jul 2014
4 answers
585 views
Just  started using Telerik reporting and noticed an odd behavior that seems specific to the report created in the Visual Studio 2013 WYSIWIG and does not occur when using a report generated in the Standing alone report designer.  I am working with the version from Q2 2014.

I first build this simple report in the stand alone report designer.  Then duplicated it using the designer and class use in the VS 2013.  This is a banded report and has 3 groups, 2 of which are bound to something and one being used to display the row headings on every page.  The first two groups have the group footer set to PageBreak After.

In my testing my data source was a stored procedure that returned data that should result in 2 pages.  In the stand alone version of the report both the preview of the report as well as when creating a pdf directly from code using the ReportProcessor.RenderReport method.  In the VS2013 WYSIWIG tool when I rebuilt the report and bound it to the stored procedure it was resulting in 4 pages.  Where page one at the data that matched the stand alone report.  Page 2 had the data from the page header, page footer and just the group1 footer, then page 3 had the same data as page 2 of the stand alone report.  And page 4 again had the page header, page footer and just the group 1 footer.

In the VS2013 WYSIWIG  this problem was fixed by setting the group footers to not be visible.  Which in this simple instance is fine, but I can see future needs that this will not  work for.  Is this a known issue?

Stef
Telerik team
 answered on 08 Jul 2014
7 answers
592 views
What would cause the viewer to come up like the attached...
It works on within VS2010 but all of a sudden my latest deploy this is what happened.. there was an upgrade to the latest versions. but when I went back it was the same....
KS
Top achievements
Rank 1
 answered on 07 Jul 2014
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?