Telerik Forums
Reporting Forum
3 answers
822 views

Hi, 

I'm very new to telerik reporting. Please check my issue below. 

I have created a telerik report using designer. This report calls stored procedure to retrieve the data and binds to chart. 

I'm getting following error message when I generate the report via report viewer. 

      "The expression contains object 'dtScan' that is not defined in the current context". 

I have already added all required report parameters (input parameters). Actually this 'dtScan' is not an input parameter. It is a one of the data table field and using inside my stored procedure. I'm sure that there is no issue on my stored procedure. It is working perfectly when I design the report (means that when I set stored procedure to report via design wizard).

As I mentioned, I'm getting this error message when I generate report via report viewer and as well as preview window (please see the attached images).

 Please looking forward your help to solve this issue. 

 Thanks!

Stef
Telerik team
 answered on 06 Nov 2015
2 answers
1.4K+ views

I'm trying to figure out how to bind a List to a List<T> property of my main data source and I'm having trouble.

 I have a report that binds like this:

                var report = new TQuoteReport
                {
                    DataSource = new ObjectDataSource
                    {
                        DataSource = quote // Quote is my object
                    }
                };

                var reportProcessor = new ReportProcessor();

                var reportSource = new InstanceReportSource()
                {
                    ReportDocument = report
                };

                var renderingResult = reportProcessor.RenderReport("PDF", reportSource, null);

                return renderingResult.DocumentBytes;

 And the Quote looks like this:

     public class Quote
    {

        public int Id { get; set; }
        public DateTime Created { get; set; }

        ...

        public List<LineItem> LineItems { get; set; }

    }

 where LineItem is just a basic object like this:

    public class LineItem

    {

        public int Id { get; set; }

        ...

    }

 

The main report binding fields work great with [= Fields.Id]

However, I can't figure out how to bind the LineItem List to a List report object. In the designer it will only let me bind the datasource with the ObjectDataSource that is set to Quote. It won't let me choose the LineItem list. I feel like I'm missing something here. 

 What am I not doing right? I would rather keep it all in one report and not do a subreport if I don't have to.

 Thanks!

        public int Id { get; set; }

     public class Quote
    {

        public int Id { get; set; }
        public DateTime Created { get; set; }

        ...

        public List<LineItem> LineItems { get; set; }

    }

     public class Quote
    {

        public int Id { get; set; }
        public DateTime Created { get; set; }

        ...

        public List<LineItem> LineItems { get; set; }

    }

Stef
Telerik team
 answered on 06 Nov 2015
3 answers
493 views
I'm trying to get my report to force a new page once the group changes. I can't see anything in the properties so I'm thinking maybe there is a way to do it in code. Anyone know of a way to do this? Thanks.
Nasko
Telerik team
 answered on 06 Nov 2015
5 answers
64 views

Hi, 

  Is it possible to turn 'off' the caching that the Report Viewer performs?

 regards

 Richard

Stef
Telerik team
 answered on 05 Nov 2015
1 answer
122 views

I'm using standalone report designer for creating report template, and I need to create Area chart, and in this chart areas will intersect. ​Can I set somehow color of the ​area to be partialy transparent so i will see back area also? I attached image of chart that I currently achive and a can't see area intersections.

 

 ​

Nasko
Telerik team
 answered on 05 Nov 2015
6 answers
363 views
Hi,

I am developing some mvc5 application. I am stuck in telerik report viewer. kindly see my code and suggest where is the issue please.
ReportViewerView1.cshtml where as  the productcatalog is the report which i am binding to this report viewer using TypeReportSource

001.@using Telerik.Reporting
002.@using Telerik.ReportViewer.Mvc
003.@{
004.    ViewBag.Title = "Telerik MVC HTML5 Report Viewer";
005.}
006. 
007.@section styles
008.{
010. 
011.    <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.common.min.css" rel="stylesheet" />
012.    <link href="http://cdn.kendostatic.com/2013.2.918/styles/kendo.blueopal.min.css" rel="stylesheet" />
013. 
014. 
015.    <style>
016.        #reportViewer1 {
017.            position: absolute;
018.            left: 5px;
019.            right: 5px;
020.            top: 5px;
021.            bottom: 5px;
022.            overflow: hidden;
023.            font-family: Verdana, Arial;
024.        }
025.    </style>
026. 
027.    <link href="@Url.Content("~/ReportViewer/styles/telerikReportViewer-9.1.15.731.css")" rel="stylesheet" />
028.}
029. 
030.@(Html.TelerikReporting().ReportViewer()
031.        // Each report viewer must have an id - it will be used by the initialization script
032.        // to find the element and initialize the report viewer.
033.        .Id("reportViewer1")
034.        // The URL of the service which will serve reports.
035.        // The URL corresponds to the name of the controller class (ReportsController).
036.        // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
037.        .ServiceUrl(Url.Content("~/api/reports/"))
038.        // The URL for the report viewer template. The template can be edited -
039.        // new functionalities can be added and unneeded ones can be removed.
040.        // For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
041.        .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-9.1.15.731.html"))
042.        // Strongly typed ReportSource - TypeReportSource or UriReportSource.
043.        .ReportSource(new TypeReportSource() { TypeName = "Telerik.Reporting.Examples.CSharp.ProductCatalog, DubaiFleet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" })
044.        // Specifies whether the viewer is in interactive or print preview mode.
045.        // PrintPreview - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
046.        // Interactive - Displays the report in its original width and height with no paging. Additionally interactivity is enabled.
047.        .ViewMode(ViewMode.Interactive)
048.        // Sets the scale mode of the viewer.
049.        // Three modes exist currently:
050.        // FitPage - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
051.        // FitPageWidth - The report will be zoomed in or out so that the width of the screen and the width of the report match.
052.        // Specific - Uses the scale to zoom in and out the report.
053.        .ScaleMode(ScaleMode.Specific)
054.        // Zoom in and out the report using the scale
055.        // 1.0 is equal to 100%, i.e. the original size of the report
056.        .Scale(1.0)
057.        // Sets whether the viewer’s client session to be persisted between the page’s refreshes(ex. postback).
058.        // The session is stored in the browser’s sessionStorage and is available for the duration of the page session.
059.        .PersistSession(false)
060.        // Sets the print mode of the viewer.
061.        .PrintMode(PrintMode.AutoSelect)
062.        // Defers the script initialization statement. Check the scripts section below -
063.        // each deferred script will be rendered at the place of TelerikReporting().DeferredScripts().
064.        .Deferred()
065.        .ClientEvents(
066.                events => events
067.                    .RenderingBegin("onRenderingBegin")
068.                    .RenderingEnd("onRenderingEnd")
069.                    .PrintBegin("onPrintBegin")
070.                    .PrintEnd("onPrintEnd")
071.                    .ExportBegin("onExportBegin")
072.                    .ExportEnd("onExportBegin")
073.                    .UpdateUi("onUpdateUi")
074.                    .PageReady("onPageReady")
075.                    .Error("onError")
076.                    )
077.        // Uncomment the code below to see the custom parameter editors in action
078.        //.ParameterEditors(
079.        //        editors => editors
080.        //            .SingleSelectEditor("createSingleSelectEditor")
081.        //            .CustomEditors(new CustomParameterEditor
082.        //            {
083.        //                MatchFunction = "customMatch",
084.        //                CreateEditorFunction = "createCustomEditor"
085.        //            })
086.        //)
087.)
088. 
089.@section scripts
090.{
091.    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer-9.1.15.731.min.js")"></script>
092. 
093.    <!--kendo.all.min.js can be used as well instead of kendo.web.min.js and kendo.mobile.min.js-->
095.    <!--kendo.mobile.min.js - optional, if gestures/touch support is required-->
097. 
098. 
099.    <script>
100.        function onRenderingBegin() {
101.            console.log("rendering begin!");
102.        }
103.        function onRenderingEnd() {
104.            console.log("rendering end!");
105.        }
106.        function onPrintBegin() {
107.            console.log("print begin!");
108.        }
109.        function onPrintEnd() {
110.            console.log("print end!");
111.        }
112.        function onExportBegin() {
113.            console.log("export begin!");
114.        }
115.        function onExportEnd() {
116.            console.log("export end!");
117.        }
118.        function onUpdateUi() {
119.            console.log("update ui!");
120.        }
121.        function onError() {
122.            console.log("error!");
123.        }
124.        function onPageReady() {
125.            console.log("page ready!");
126.        }
127. 
128.        function createSingleSelectEditor(placeholder, options) {
129.            var dropDownElement = $(placeholder).html('<div></div>');
130.            var parameter,
131.                  valueChangedCallback = options.parameterChanged,
132.                  dropDownList;
133. 
134.            function onChange() {
135.                var val = dropDownList.value();
136.                valueChangedCallback(parameter, val);
137.            }
138. 
139.            return {
140.                beginEdit: function (param) {
141. 
142.                    parameter = param;
143. 
144.                    $(dropDownElement).kendoDropDownList({
145.                        dataTextField: "name",
146.                        dataValueField: "value",
147.                        value: parameter.value,
148.                        dataSource: parameter.availableValues,
149.                        change: onChange
150.                    });
151. 
152.                    dropDownList = $(dropDownElement).data("kendoDropDownList");
153.                }
154.            };
155.        }
156. 
157.        function customMatch(parameter) {
158.            return Boolean(parameter.availableValues)
159.                && !parameter.multivalue
160.                && parameter.type === telerikReportViewer.ParameterTypes.BOOLEAN;
161.        }
162. 
163.        function createCustomEditor(placeholder, options) {
164.            var dropDownElement = $(placeholder).html('<div></div>');
165.            var parameter,
166.                  valueChangedCallback = options.parameterChanged,
167.                  dropDownList;
168. 
169.            function onChange() {
170.                var val = dropDownList.value();
171.                valueChangedCallback(parameter, val);
172.            }
173. 
174.            return {
175.                beginEdit: function (param) {
176. 
177.                    parameter = param;
178. 
179.                    $(dropDownElement).kendoDropDownList({
180.                        dataTextField: "name",
181.                        dataValueField: "value",
182.                        value: parameter.value,
183.                        dataSource: parameter.availableValues,
184.                        change: onChange
185.                    });
186. 
187.                    dropDownList = $(dropDownElement).data("kendoDropDownList");
188.                }
189.            };
190.        }
191.    </script>
192. 
193.    @(
194. 
195.        // All deferred initialization statements will be rendered here
196.        Html.TelerikReporting().DeferredScripts()
197.    )
198.}


 Controller for reportviewer
01.namespace DubaiFleet.Views.ReportsMain.Controllers
02.{
03.    using System.IO;
04.    using System.Web;
05.    using Telerik.Reporting.Cache.File;
06.    using Telerik.Reporting.Services;
07.    using Telerik.Reporting.Services.WebApi;
08.
09.    //The class name determines the service URL.
10.    //ReportsController class name defines /api/report/ service URL.
11.    public class ReportsController : ReportsControllerBase
12.    {
13.        static ReportServiceConfiguration configurationInstance;
14.
15.        static ReportsController()
16.        {
17.            //This is the folder that contains the XML (trdx) report definitions
18.            //In this case this is the app folder
19.            var reportsPath = HttpContext.Current.Server.MapPath("~/");
20.
21.            //Add resolver for trdx report definitions,
22.            //then add resolver for class report definitions as fallback resolver;
23.            //finally create the resolver and use it in the ReportServiceConfiguration instance.
24.            var resolver = new ReportFileResolver(reportsPath)
25.                .AddFallbackResolver(new ReportTypeResolver());
26.
27.            //Setup the ReportServiceConfiguration
28.            configurationInstance = new ReportServiceConfiguration
29.            {
30.                HostAppId = "Html5App",
31.                Storage = new FileStorage(),
32.                ReportResolver = resolver,
33.                // ReportSharingTimeout = 0,
34.                // ClientSessionTimeout = 15,
35.            };
36.        }
37.
38.        public ReportsController()
39.        {
40.            //Initialize the service configuration
41.            this.ReportServiceConfiguration = configurationInstance;
42.        }
43.    }
44.}

kindly suggest me accordingly. I am using reportviewerview1.cshtml as partialview in my own page.

Regards,

Faisal
Nasko
Telerik team
 answered on 05 Nov 2015
1 answer
57 views

HI,

i have a problem that i can't solve. i have a telerik report. in details section i have a table that bund to data source, and after it i have a repeated list (that bound to another property in data source).

the problem is, that when item in list (such as textbox) wich contain long text above one page (on Pdf design), it break the page between the table outsize the list and the first item in list.

how can i minimize the space?

i need it urgently.

Thanks,

ChavK.

Nasko
Telerik team
 answered on 05 Nov 2015
3 answers
189 views

Greetings,

 

I need your help with the below issue.

 

I'm streaming an exported PDF from a telerik report and I need to insert JavaScript to be executed after acrobat event 'DidPrint' which I want to execute to close the PDF file after the filed being printed.

 Below is how I render the report as PDF and print it sielently.

 

       deviceInfo["JavaScript"] = "this.print({bUI: false, bSilent: false, bShrinkToFit: true});";
            var reportProcessor = new ReportProcessor();
            var reportSource = new Telerik.Reporting.InstanceReportSource();
            Report1 report = new Report1();
            report.ReportParameters["ID"].Value = "10";
            reportSource.ReportDocument = report;
            var renderingResult = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);

Stef
Telerik team
 answered on 04 Nov 2015
2 answers
49 views
Hi. 

I'm trying to display the subtotal of fields.amount to page footer using the PageExec Function, 
but it doesn't show on the report viewer even I switch it into print view. [Please find attachment below.


I wonder if someone can help me with this? 



PS:
I'm using Telerik Reporting Q2 2015 SP1.
Von Aaron
Top achievements
Rank 2
 answered on 04 Nov 2015
7 answers
222 views
We are binding our reports through the code-behind.  I need to create a drillthrough report.  I have watched the video, and set up the Master report action correctly -- I selected the child report using the "Select Report Document" and I created the target report parameter. On the Child Report, I have created the parameter to match the one specified within the master.

However, on my child report, I cannot figure out how to access this parameter. It is not being passed into the constructor (get an error if I force the constructor to accept a parameter) and the "Load" and "Init" events of the child report do not fire.  The value of the Report.Parameter I have defined is null.

How can I access this passed-in parameter value?
Stef
Telerik team
 answered on 03 Nov 2015
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?