Telerik Forums
Reporting Forum
1 answer
190 views

I downloaded the "AngularJSDemo" project and it works out of the box.  Still in my (TypeScript) AngularJS project does not.  I am using the sample directive declaration:

iapp.directive('report', function () {
   return {
      restrict: 'EA',
      transclude: 'true',
      scope: {
         name: '@',
         parameters: '@'
      },
      template: "",
      link: function (scope:any, element, attrs) {
         //create the viewer object first, can be done in index.html as well
         var reportViewer = $("#reportViewer1").data("telerik_ReportViewer");
         if (!reportViewer) {
            $("#reportViewer1").toggle();
           
            $(document).ready(function () {
               var d: any = $("#reportViewer1");
               var f: Function = $("#reportViewer1")["telerik_ReportViewer"];
               //$("#reportViewer1").telerik_ReportViewer({
               f({
                  error: function (e, args) {
                     alert('Error from report directive:' + args);
                  },
                  reportSource: {
                     report: scope.name,
                     parameters: JSON.parse(scope.parameters),
                  },
                  serviceUrl: '/api/reports/',
                  scale: 1.0,
                  ready: function () {
                     alert("up's");
                  },
               })
            });
         }
         //on state change update the report source
         scope.$watch('name', function () {
            var reportViewer = $("#reportViewer1").data("telerik_ReportViewer");
            if (reportViewer) {
               var rs = reportViewer.reportSource();
               if (rs && rs.report)
                  if (rs.report != scope.name &&
                     rs.parameters != scope.parameters) {
                     reportViewer.reportSource({
                        report: scope.name,
                        parameters: JSON.parse(scope.parameters),
                     });
                  }
            }
         });
      }
   }
});

and a similar template as follows:

<div class="container-fluid" ng-controller="reportViewModel">
   <!--<h2>{{Title}}</h2>-->
   <div class="spacing">Title:  {{report.settings.title}}</div>
   <div class="spacing">Name: {{report.settings.reportName}}</div>
   <div class="spacing">Params: {{report.settings.reportParams}}</div>
   <hr />
   <report name="{{report.settings.reportName}}" parameters="{{report.settings.reportParams}}"></report>
</div>

-----------------------------------------------------

All looks good, and I can see that the "link" and "$watch" functions being called as expected, still the report viewer does not show-up!  I do see that when the "$watch" (for "name") gets triggered that the "var reportViewer = $("#reportViewer1").data("telerik_ReportViewer");" always returns "undefined" (reportViewer is undefined).  if I go to the browser and type: ".../api/reports/" I do get to the controller (as expected), but it should be called upon initialization (within link") but it never happens... 

If someone have a bit of a clue what else I should be looking for it will be nice to know, until then... thanks.

Ed.

 

Katia
Telerik team
 answered on 30 Jan 2017
3 answers
413 views

I have a MVC application and am trying to pass parameters from client side to objectdatasource.

The client code is like:

 @(Html.TelerikReporting().ReportViewer()
                      .Id("report-viewer1")
                      .ServiceUrl(Url.Content("~/api/reportservice/"))
                      .TemplateUrl(Url.Content("~/content/reportviewer/templates/telerikReportViewerTemplate.html"))

                        ....................

                     .ReportSource("report.trdp", new Dictionary<string, object>() { { "parameter1", "value1" }, { "parameter2", "value2" } })

                )

report.trdp is created with Reporting Designer.  it is configured to get the data from objectdatasource (binding to the extension assembly and function).

The question is: how can I pass "parameter1" and "parameter2" from the client side to the extension function at the server side to limit the data query?

Jerry
Top achievements
Rank 1
 answered on 30 Jan 2017
7 answers
711 views

Hello,

I have made a report that has important properties in its code behind that I am attempting to access using "ReportDefinition.PropertyName" in expressions. This technique works perfectly in the Preview tab at design time, however in the Html5 WebForms ReportViewer control, this method of referencing properties always returns null. Note that 1) I know that the properties are not null, and 2) in the same report in the same control, I'm successfully referencing a method in the code behind that returns a string including some of the values of those same properties. Currently my references to ReportDefinition are mostly in TextBoxes, but moving them to report parameters does not solve the problem.

Example of an expression I'm using in a TextBox: '= IsNull(ReportDefinition.OrderNumber, "INVALID ID")'

Why can I successfully reference methods using ReportDefinition at both design time and run time, but only successfully reference properties at design time?

Thanks,

Shane

Shane
Top achievements
Rank 1
 answered on 27 Jan 2017
1 answer
133 views

I am trying to create a bibliography in my report using the Chicago style citation format. I am unable to create the proper indents. The style dictates that if a citation is more than one line the second and subsequent lines are indented further in than the first line of the citation. This makes it easy to read multiple citations on a page.

I can achieve this in html using negative margins with css. I know the htmltextbox supported html/css is limited and so far I have not been able to create this formatting. 

Is there any way to do this?

I've thought about adding spaces or tab characters in my data dynamically at runtime taking into account the page size and font size but I was hoping there would be an easier way.

 

Stef
Telerik team
 answered on 27 Jan 2017
7 answers
1.6K+ views
Hi there,   
   I'm new to Telerik reporting and I'm haveing a problem with the expressions. I have 3 textboxes with number values and 1 other textbox that woill be the total of the 3. But when I run the report it gives me an error "The expression contains object "fldMMHQ_USD" that is not defined in the current context". I don't understand. The textbox is there, I see the values, but the "Total" textbox doesn't seem to the others. Here is my expression: = fldMMHQ_USD + fldMM_USD + fldEMPR_USD. Thanks for the help
Stef
Telerik team
 answered on 27 Jan 2017
2 answers
68 views

Hi to all,

I have a report in a solution that has several projects referenced between them

  • Client (WPF): reference Report and Entities
  • Entities (Assembly)
  • Resources (Assembly): bitmap called LOGO.BMP with ActionBuild=Resources and saved into root of project
  • Reports (Assembly) reference: Entities and Resources

I have valued a property value of picturebox with a string in this mode PictureUrl = "pack://application:,,,/Brema.Resources;component/LOGO.BMP";

If I use this url in XAML file of my application it works correctly, but if I use in my report it shows me an errore that says url with wrong format (see attachment).

Why? I read Microsoft documentation about Uri format, but it's all correct, infact, it works as Uri in WPF application.

 

Stef
Telerik team
 answered on 26 Jan 2017
5 answers
460 views
I am trying to use a field with a space in its name (eg:"State ID") for the value of a textbox, but I cannot figure out the correct syntax to do this in the design view.

When I open up the expression editor nothing shows up when I select fields. How can I do this? The field is from an SqlDataSource.
Will
Top achievements
Rank 1
 answered on 25 Jan 2017
1 answer
103 views

Hi

I have a problem with alignment of column in report: the data in the column does not start in the same position for each row, and in many of rows in the same column, data start with indent and in many of the other rows , start with negative indent then they are in the same line.

we try to set padding style for TextBox object , and all words are readable but the problem is that : when you see data in column , many of words have too many space from start position.

According to the attachment , you can see that depends on length of characters in each row , indent is more negative.

Thank you for support.

 

Katia
Telerik team
 answered on 25 Jan 2017
1 answer
419 views

Hi All,

I wanted to pass the viewmodel to report viewer in Reportview.cshiml. but I havn't got any such examples . always seeing the example on to bind the datasource in the ReportController . binding data source from report controller working as expected but looking for help on the view model binding in Razor Syntax.

 

My Cshtml Code

 

@using ReportingLibrary
@using Telerik.ReportViewer.Mvc
@using CPGUX.ProjectManagement.Core.Entities
@using CPGUX.Utility.Helpers
@model IEnumerable<ProjectDetails>

 

@(Html.TelerikReporting().ReportViewer()
 .Id("reportViewer1")
 .ServiceUrl(Url.Content("~/api/reports/"))
 .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-FA.html"))
 .ReportSource(new Telerik.Reporting.TypeReportSource() { TypeName = typeof(CPGUX.ReportingLibrary.AllProjectsByUser).AssemblyQualifiedName })
 .ViewMode(ViewMode.Interactive)
 .ScaleMode(ScaleMode.Specific)
 .Scale(1.0)
 .PersistSession(false)
 .PrintMode(PrintMode.AutoSelect)
 .Deferred()
)

 

 

ReportController.cs

 

public Telerik.Reporting.ReportSource Resolve(string report)
{
Report reportInstance = null;
if (report.Contains("AllProjectsByUser"))
    {

       string result = _projectController.GetProjectNumberSession();// new ProjectController().GetProjectNumberSession();
      reportInstance = new AllProjectsByUser();
      reportInstance.DataSource =  _projectService.FindProjectsByUser(IIdentityUser, 100, 0); // don't want to call instead of binding should haven in viewer itself

    }

}

 

Stef
Telerik team
 answered on 25 Jan 2017
1 answer
351 views

I am beginner in Telerik Reporting. I have created an Telerik Report by Telerik Report Q1 2016 Wizard. The designer is showing report well but when i attach it with Telerik Report Viewer it gives following error:

 

"an error occured while processing Table 'table1':

Unable to establish a connection to the database. Please, verify that your connection is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your aplicaion.

--------InnerException---------

Format of the initialization string does not conform to specification starting at index 0."

 

My code is:

 private void ReportViewerForm1_Load(object sender, EventArgs e)
        {
            Report1 rp = new Report1();
            reportViewer1.Report = rp;
            
            this.reportViewer1.RefreshReport();
        }

 

Stef
Telerik team
 answered on 25 Jan 2017
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?