Telerik Forums
Reporting Forum
1 answer
110 views
Hello.

We have created a custom ADO.Net provider that accesses web service and returns a DataTable object. I have successfully inorporated into the Report Designer and everything works fine except when we have a parameterized SQL statement. When you create a data source with SqlClient Data Provider and it has a parameterized SQL statement a Data Source Parameters dialog box shows up where you can specify data types and default values. 

The command class is inherited from DbCommand and adds parameters when CommandText was changed:
public class AbstractCommand : DbCommand
{
        private string commandText;
        private AbstractParameterCollection parameters;

...
        public override string CommandText
        {
            get
            {
                return this.commandText; 
            }
            set
            {
                this.commandText = value;
                this.CreateParameters();
            }
        }

        protected override DbParameterCollection DbParameterCollection
        {
            get 
            {
                if (this.parameters == null)
                {
                    this.parameters = new AbstractParameterCollection();
                }

                return this.parameters;
            }
        }

        private void CreateParameters()
        {
            this.Parameters.Clear();
            if (this.commandText == null)
            {
                return;
            }

            string[] lines = this.commandText.Split(new char[] { '@' });
            for (int i = 1; i < lines.Length; i++)
            {
                string line = lines[i];
                string[] split = line.Split(new char[] { ' ', '\t' });
                if (split.Length == 0)
                {
                    continue;
                }
                split = split[0].Split(Environment.NewLine.ToArray());
                if (split.Length == 0)
                {
                    continue;
                }
                this.Parameters.Add(
                    new AbstractDataParameter()
                    {
                        ParameterName = "@" + split[0],
                    });
            }
        }
}

I have comfired that the parameters are populated correctly and the dialog box still don't how.

FYI, the config file has this:
<system.data>
    <DbProviderFactories>
        <add name="Local Abstract Data Provider"
             invariant="LocalAbstractDataProvider" 
             description="Data Provider for Netsmart VR" 
             type="LocalAbstractDataProvider.AbstractDbProviderFactory, LocalAbstractDataProvider, Version=1.0.0.0" />
    </DbProviderFactories>
</system.data>  

Do you have any idea?


















Shoji Kaburagi
Top achievements
Rank 1
 answered on 13 Jan 2015
1 answer
239 views
Hello together

I have two nearly identical reports and in both the same problem:
I've got three subreport items side by side but even when I put them next to each other there are horizontal spaces between the three subreports.
The subreport items' sizes match the actual report sizes and I already tried making the subreport items a bit wider than the actual reports.
I even had the problem that the right margin of the 3rd subreport item didn't fit right below the line above even though in the designer they were aligned properly.
This one I was able to fix (don't know how exactly) but the spaces between the reports I wasn't able to fix.

Thanks for any help
Nasko
Telerik team
 answered on 13 Jan 2015
3 answers
285 views
Hi ,

I have a table created from a table wizard  and now i want to insert a subreport below it  based one of its fields.

CustomerId Customer Report
Sub report related  to  Each customer ID

I have done the passing of the Customer ID field to the Subreport  customer Id  filter....but   an error keeping coming saying

Exception: Invalid value of report parameter 'CustomerID'.]

Can anyone throw some light on it please?

 
Nasko
Telerik team
 answered on 13 Jan 2015
1 answer
257 views
I'm trying to add 2 sub reports programmatically on the report footer section like this

               //This is called twice with a different myString content which is a XML string
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreWhitespace = true;

                using (XmlReader xmlReader = XmlReader.Create(new StringReader(myString), settings))
                {
                    ReportXmlSerializer xmlSerializer = new ReportXmlSerializer();

                    Telerik.Reporting.Report subreport = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
                    Telerik.Reporting.InstanceReportSource source = new Telerik.Reporting.InstanceReportSource();
                    source.ReportDocument = subreport;

                    Telerik.Reporting.SubReport footerSubReport = new Telerik.Reporting.SubReport();
                    footerSubReport.ReportSource = source;
                    footerSection.Items.Add(footerSubReport);
                }
            }
        }

These 2 sub reports were created originally on the Telerik Designer with extension trdx and then changed to xml. The width of both is 15cm while on the main report, the width is 19.51cm. Enough to avoid and spread of the width.

When only 1 sub report is added everything is ok but then when I add both subreports; blank pages are added. I tried to change the background color to identify the problem. Each sub report is really narrow (15 cm) in contrast to the main report (19.51 cm) but the report footer looks bigger in width producing the blank pages.

I set property KeepTogether of my report footer to false and each sub report xml has the property PageBreak = Before.

These are my two subreports in xml format

---------------------------------
Sub Report 1 
---------------------------------

<?xml version="1.0" encoding="utf-8"?>
<Report Width="15cm" Name="SubReport1" xmlns="http://schemas.telerik.com/reporting/2012/3.5">
  <Items>
    <DetailSection PageBreak="Before" Height="1.7322834332784in" Name="detailSection1">
      <Style Visible="True" BackgroundColor="0, 128, 255" VerticalAlign="Bottom" />
      <Items>
        <TextBox Width="11.7999992370605cm" Height="2.3600001335144cm" Left="0.00010012308478013cm" Top="0.299999848604206cm" Value="Testing1" Name="textBox1">
          <Style>
            <Font Bold="True" />
          </Style>
        </TextBox>
      </Items>
    </DetailSection>
  </Items>
  <StyleSheet>
    <StyleRule>
      <Style>
        <Padding Left="2pt" Right="2pt" />
      </Style>
      <Selectors>
        <TypeSelector Type="TextItemBase" />
        <TypeSelector Type="HtmlTextBox" />
      </Selectors>
    </StyleRule>
  </StyleSheet>
  <PageSettings>
    <PageSettings PaperKind="Letter" Landscape="False">
      <Margins>
        <MarginsU Left="0cm" Right="0cm" Top="0cm" Bottom="0cm" />
      </Margins>
    </PageSettings>
  </PageSettings>
</Report>

---------------------------------
Sub Report 2 
---------------------------------

<?xml version="1.0" encoding="utf-8"?>
<Report Width="15cm" Name="SubReport2" xmlns="http://schemas.telerik.com/reporting/2012/3.5">
  <Items>
    <DetailSection PageBreak="Before" Height="1.7322834332784in" Name="detailSection1">
      <Style Visible="True" BackgroundColor="0, 128, 255" VerticalAlign="Bottom" />
      <Items>
        <TextBox Width="11.7999992370605cm" Height="2.3600001335144cm" Left="0.00010012308478013cm" Top="0.299999848604206cm" Value="Testing2" Name="textBox1">
          <Style>
            <Font Bold="True" />
          </Style>
        </TextBox>
      </Items>
    </DetailSection>
  </Items>
  <StyleSheet>
    <StyleRule>
      <Style>
        <Padding Left="2pt" Right="2pt" />
      </Style>
      <Selectors>
        <TypeSelector Type="TextItemBase" />
        <TypeSelector Type="HtmlTextBox" />
      </Selectors>
    </StyleRule>
  </StyleSheet>
  <PageSettings>
    <PageSettings PaperKind="Letter" Landscape="False">
      <Margins>
        <MarginsU Left="0cm" Right="0cm" Top="0cm" Bottom="0cm" />
      </Margins>
    </PageSettings>
  </PageSettings>
</Report>

Luis
Top achievements
Rank 1
 answered on 12 Jan 2015
3 answers
460 views
I am trying to change the connection string of a UriReportSource at runtime in an MVC 4 application.  I am using this page as a guide:

http://www.telerik.com/support/kb/reporting/details/changing-the-connection-string-dynamically-according-to-runtime-data

However I end up getting this error: "Unable to get report parameters: Missing report name"

Here is the ReportsController:

public class ReportsController : ReportsControllerBase
{
    protected override IReportResolver CreateReportResolver()
    {
 
        var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");
 
        return new ReportFileResolver(reportsPath)
            .AddFallbackResolver(new ReportTypeResolver());
        //return new CustomReportResolver();
    }
 
    protected override ICache CreateCache()
    {
        return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
    }
}

Code for the controller for the view containing the ReportViewer:

public ActionResult Index()
{
    string connectionString = GetConnectionString();
    ReportConnectionStringManager connStringManager = new ReportConnectionStringManager(connectionString);
    string uri = Server.MapPath("/Reports/Tickets2.trdx");
    UriReportSource theReport = new UriReportSource() { Uri = uri };
    InstanceReportSource fixedReport = connStringManager.UpdateReportSource(theReport);
    return View(new ReportModel() { TheReport = fixedReport });
}
 (Note that ReportModel.TheReport is of type InstanceReport)

And the View:

@model FastTrack.MVC.Models.ReportModel
@{
    ViewBag.Title = "Reports";
}
 
@section styles
{      
    <link href="ReportViewer/styles/telerikReportViewer-8.1.14.618.css" rel="stylesheet" />
<style>
        #reportViewer1 {
            position: relative;
            width: 100%;
            height: 1000px;
            font-family: 'segoe ui', 'ms sans serif';
            overflow: hidden;
        }
    </style>
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
}
 
@section scripts
{
    <script src="ReportViewer/js/telerikReportViewer-8.1.14.618.js"></script>
}
<div class="container">
<div class="row">
            @(Html.TelerikReporting().ReportViewer()
                   .Id("reportViewer1")
                   .ServiceUrl("/api/reports/")
                   .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.618.html")
                   .ReportSource(@Model.TheReport)
                   .ViewMode(ViewModes.INTERACTIVE)
                   .ScaleMode(ScaleModes.SPECIFIC)
                   .Scale(1.0)
                   .PersistSession(false)
                   )
 
    </div>
    </div>

I have verified that passing the reportviewer is working when simply passing the report in as a Uri, but we have to be able to change the connection string dynamically because or data/connections are tenant-based.

Any help is appreciated
Stef
Telerik team
 answered on 12 Jan 2015
12 answers
2.0K+ views
I have a report where I need to dynamically show a different image on a row-by-row basis based on the data in that row. Is there an example on how to do this? If not, if someone has figured this out can you post an example?
KS
Top achievements
Rank 1
 answered on 12 Jan 2015
1 answer
150 views
Hi Sir,
      Here, we are using Report Book for multiple reports for a particular patient. Where the reports, occupies every single page for each report.
so, here i am tried with Sub Report., but i cant able to get the solution as well. I need to merge multiple reports. 

please see the attachment (screenshot : Print.jpg)

Thanks & Regards,
 R. Sindhu.

Stef
Telerik team
 answered on 09 Jan 2015
20 answers
3.2K+ views
Hi again, I need to pass a parameter to reportViewer, in the report that I designed in telerik report designer I added a parameter so I want to pass the values ​​from a String value outside the ReportViewer I do not want to enter the value in the field shown in the reportviewer beside the preview button. (see report.png image) and i need s

Is there any way to access these properties? and how to resize the text box that receives the parameter because I want my reportviewer size you see in the picture but the box paraecer shrinks when I change the size of reportviewer, and I need to call the click event Preview button but from another button, is that possible? being so hide the parameter, and how I do to remove this error "An error has occurred while processing, incorrect syntax near ')' " this happens because I don't give a value I just set the "=Parameters.Name.Value"

Sorry for my English, I hope you can help me!
Fridli Jacober
Top achievements
Rank 1
 answered on 09 Jan 2015
1 answer
178 views
I've reported this in a support ticket, but a) I haven't had a response yet, and b) I thought others ought to be aware of this too.
I've managed to get reports with the html5 report viewer working fine a few months ago, but somehow the instructions on the Telerik site don't seem to have kept up with changes to the standard Visual Studio MVC/WebApi templates.
From my support ticket request:

I've been trying to get even a basic Report working in MVC/WebApi projects and the Telerik current instructions as to how to do it no longer seem to work, perhaps because of changes in the versions of some Microsoft dlls (and possible changes in the template files, eg to WebApiConfig.cs and Global.asax) in current Visual Studio 2013 Update 3 projects.

I've had a variety of problems, including run time errors (like the one below, or saying that the .../client resource could not be found), but I attach an example project.

This project was just a basic, right out of the box MVC5/WebApi web application that I created from the templates in Visual Studio 2013 Update 3.  I checked that it built and ran fine. I then added a Telerik Html5 Report Viewer Item Template (Q3 2014) to the project.  A report page then came up telling me that I needed to add various redirects to the web.config file (because the project contained newer versions of dlls than those expected) - I added these lines to the web.config file.

Then I built the project successfully, but when I tried running it, I got the following error in Application_Start() in Global.asax.cs: " Adding or removing items from a 'HttpRouteCollection' is not supported. Please use a key when adding and removing items":


 // this line gives the following error when running the project:
            // Adding or removing items from a 'HttpRouteCollection' is not supported. Please use a key when adding and removing items.
            ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);

How can I solve this?  Please will you consider rechecking your installation instructions and modifying them as necessary so that they work with the current Visual Studio standard templates for MVC/WebApi projects?
Stef
Telerik team
 answered on 08 Jan 2015
12 answers
222 views
I don't understand why, but when I add a Table Wizard, I can't select or Add any Data source. Can you tell me why ?  thanks.
Stef
Telerik team
 answered on 08 Jan 2015
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?