Telerik Forums
Reporting Forum
0 answers
129 views
I am using Q1 2011 version of Telerik Reporting.

Scenario:
I am using User Functions to build an address (and some other key information) for Shipping information (contained in 2 subreports) that are used in an Order Detail report.

Here is the code for the User Function that builds the Ship To information:
Public Shared Function GetShipToInfo(ByVal Name As Object, ByVal Addr1 As Object, ByVal Addr2 As Object, ByVal City As Object, ByVal State As Object, ByVal PostalCode As Object, ByVal Country As Object, ByVal Carrier As Object, ByVal ShipDate As Object) As String
    Dim address As String = ""
    If Not IsDBNull(Name) AndAlso Name IsNot Nothing Then
        address &= Name.ToString.Trim & vbCr
    End If
    If Not IsDBNull(Addr1) AndAlso Addr1 IsNot Nothing Then
        address &= Addr1.ToString.Trim & vbCr
    End If
    If Not IsDBNull(Addr2) AndAlso Addr2 IsNot Nothing AndAlso Addr2.ToString.Trim.Length > 0 Then
        address &= Addr2.ToString.Trim & vbCr
    End If
    If Not IsDBNull(City) AndAlso City IsNot Nothing Then
        address &= City.ToString.Trim
    End If
    If Not IsDBNull(State) AndAlso State IsNot Nothing Then
        address &= ", " & State.ToString.Trim
    End If
    If Not IsDBNull(PostalCode) AndAlso PostalCode IsNot Nothing Then
        address &= "  " & PostalCode.ToString.Trim & vbCr
    End If
    If Not IsDBNull(Country) AndAlso Country IsNot Nothing AndAlso Country.ToString.Trim.Length > 0 Then
        address &= Country.ToString.Trim & vbCr
    End If
    address &= vbCr & "Carrier: "
    If Not IsDBNull(Carrier) AndAlso Carrier IsNot Nothing Then
        address &= Carrier.ToString.Trim
    End If
    address &= vbCr
    address &= "Ship Dt: "
    If Not IsDBNull(ShipDate) AndAlso ShipDate IsNot Nothing Then
        address &= CDate(ShipDate).ToString("d")
    End If
    Return address
End Function

The Issue:
When this information is displayed in the Web Report Viewer, I see all of the information; however, there should be an empty line between the last line of the address and the "Carrier".  In the Web Report Viewer, this does not occur.  In addition, when you print the report (or export to PDF -- the same thing), the empty line occurs between the last line of the address and the "Carrier" (which matches the user function) BUT the Ship Dt goes misssing.

See the attached files UserFunctionAddress_In_Viewer.jpg and UserFunctionAddress_As_PDF.jpg.  Check out the Ship To Address information about 1/2 way across the image to see what I am talking about.

I went back through the main report and subreport and checked height settings for textbox report controls, sections, etc.  In addition, I confirmed that the textbox control has CanGrow=True.  All settings appear to be set correctly.  Certainly, the web report viewer agrees since the user can visually see all the information...but the export to PDF drops some information (in this case the Ship Dt).

Learnings:
  1. If you are using User Functions to build text (especially if you are adding carriage returns) do not rely on the visual look in the Telerik Report Viewer.  You must check the visual representation of the report as a PDF.  [Note:  When Telerik Reporting prints a report, it renders it as a PDF first.]
  2. Again, if you are using User Functions, you should set the size of any Textbox Reporting Control to the maximum size you expect to see from your data set.  You cannot rely on the CanGrow property to handle the data overflow.

Hopefully this may help some of the other Telerik Reporting developers out there.  The key is...ALWAYS ALWAYS ALWAYS check the report as a PDF before deploying reports to your user community.

Dennis
Top achievements
Rank 2
 asked on 06 Apr 2012
3 answers
193 views
I have created a WPF application that uses SQL CE 4.0 database and runs fine, however, when I try to view a report that uses the same database I get the below error

An error has occurred while processing Report 'RacerAverages':
Unable to establish a connection to the database. Please, verify that your connection string 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 application.
------------- InnerException -------------
Unable to find the requested .Net Framework Data Provider. It may not be installed. 

The report works fine in the VS 2010 environment and all data is shown but not when deployed or run in debug mode. All CE .dlls are copied to the Debug folder? 

Is there something special I am missing? Below is my config settings...
<add name="RacingApp.Properties.Settings.RacerAveragesSQL" connectionString="Data Source=C:\data\RacingAppData.sdf"
      providerName="Microsoft.SqlServerCe.Client.4.0" />

I have the SQL 4.0 CE and VS 2010 Tools installed. I have seen this Thread, which seems to be similar but have done everything
mentioned with no resolution?

Please help, this has been a thorn in my side for weeks now...

thanks,
SD.
Steve
Telerik team
 answered on 06 Apr 2012
6 answers
601 views
So, created the dashboard (report....have to call it a dashboard...don't ask), and have it set the way I want it.  It's a very basic three text inputs and a chart for results.  The trouble is the button that says "Preview".  I wanted to change it to say "Run", however, it doesn't look like there is any line in the code to do so.

Am I missing something?


Thanks gang!
Matt
Top achievements
Rank 1
 answered on 06 Apr 2012
3 answers
675 views
Can we combine multiple rows into single row in telerik??
I have report in which i have 15 sub sections.In which one of  sub section is PatientData.
I have placed table for each section and assigned corresponding datasources to each table.
Eg: tablePatientData -- PatientDataSource
tablePatientDetails-- PatientDetailsDatasource

For eg: I have a requirement like from DB Patient information was returned in  4 rows.
PatientId  PatientData
1                Test1
2                Test2
3                Test3
4                Test4

In UI i need to display it as below

Patient Data Heading
-------------------------------------------------------------
Test1,Test2,Test3,Test4

I need the information on how can we acheive this in Telerik reporting??
Steve
Telerik team
 answered on 06 Apr 2012
5 answers
243 views
Hello, 

I have a number of reports, I do not wish to create a viewer for each report, can I reuse the same ReportViewer and the winform for multiple reports by creating properties that pass in the Report to instantiate to the Winform.  I've created a separate library for my reports and now wish to instantiate my reports in the one viewer.  Is it good practice to instantiate my Report in a calling form and then pass it to the Winform that holds the viewer, cast it to a (Telerik.Reporting.IReportDocument) object and set the ReportViewers REPORT property.

Using Reporting Q3 2011

Thanks,

Kerry
Steve
Telerik team
 answered on 06 Apr 2012
1 answer
479 views
Hi,

I'm hitting an error building the Reporting samples (or any other project using them):

Error 1 The tag 'ReportViewer' does not exist in XML namespace 'clr-namespace:Telerik.ReportViewer.Silverlight;assembly=Telerik.ReportViewer.Silverlight'. C:\Program Files (x86)\Telerik\Reporting Q3 2011\Examples\CSharp\SilverlightDemo\MainPage.xaml 48 14 CSharp.SilverlightDemo

* Telerik Reporting Q3 2011 SP1 (5.3.12.119)
* Visual Studio 2010 Ultimate (10.0.40219.1 SP1Rel)
* Building C# Silverlight applications

What I've found so far:
1. The samples (and my own applications) work fine on multiple Windows Server 2003 environments that I've tried it on.
2. The samples (and my own applications) all fail to compile on the one Windows Server 2008 R2 environment that I've tried it on. Not certain if the OS difference is a factor, or if this is just a coincidence.
3. Uninstalling / re-installing Telerik Reporting on the Windows Server 2008 R2 environment has not resolved it.
4. Yes, I am running Visual Studio as an Administrator.
5. Commenting out the ReportViewer in the .xaml file and creating it programmatically in the .cs file works fine.
6. Autocomplete when editing the .xaml works fine and appears to correctly resolve; however, compilation fails.
7. Other Telerik components are NOT affected. RadControls for Silverlight works great on all environments.

Any thoughts on what I should look at next? Any assistance appreciated...

Thanks,

William Cook
Chris Gillies
Top achievements
Rank 1
 answered on 06 Apr 2012
3 answers
572 views
Hello,

I tried to define a project SqlDataSource using a stored procedure. I defined it with a default value as required in order to see it in the Data Explorer. However, when I go to select the table item I applied the data source to, the Data Explorer shows No Data Source.

I used SQL Profiler to see what was happening. When I click on the data source at the bottom of the designer it executes the stored procedure with all parameters as null, thus returning no result set.

I opened the SqlDataSource component I created and it does have the parameter defined with a default value.

Oh, and if you select Preview it returns data.

Any help would be appreciated.
Steve
Telerik team
 answered on 06 Apr 2012
0 answers
400 views

I ran into the following issue when trying to build a report and although I finally found the answer in Telerik's documentation it wasn't without some lost productivity.  Perhaps this thread can help out some other developers.

Scenario:
So I was working on the visual representation on a number of .aspx web pages and
I had to switch over to create a report that was a form letter.  My typical process when I develop in this fashion is to...

  1. Develop the report without a data source
  2. Call the report programmatically and give it a data source
  3. Output the report to the web viewer, pdf or some other export format

In the form letter I wanted to create a date in a certain format and an inside address for the letter.  I created two user
functions to accomplish this. [Note:  If you haven't looked into using user functions for your Telerik reports then I would
recommend doing so as Telerik has provided a powerful mechanism for extending functionality].

In my Telerik Reporting Class Library, I added a class file named UserFunctions.vb  Here is the code:

Public Class UserFunctions
  
    Public Shared Function GetAddress(ByVal Name As Object, ByVal Addr1 As Object, ByVal Addr2 As Object, ByVal City As Object, ByVal State As Object, ByVal PostalCode As Object, ByVal Country As Object) As String
        Dim address As String = ""
        If Not IsDBNull(Name) AndAlso Name IsNot Nothing Then
            address &= Name.ToString.Trim & vbCr
        End If
        If Not IsDBNull(Addr1) AndAlso Addr1 IsNot Nothing Then
            address &= Addr1.ToString.Trim & vbCr
        End If
        If Not IsDBNull(Addr2) AndAlso Addr2 IsNot Nothing AndAlso Addr2.ToString.Trim.Length > 0 Then
            address &= Addr2.ToString.Trim & vbCr
        End If
        If Not IsDBNull(City) AndAlso City IsNot Nothing Then
            address &= City.ToString.Trim
        End If
        If Not IsDBNull(State) AndAlso State IsNot Nothing Then
            address &= ", " & State.ToString.Trim
        End If
        If Not IsDBNull(PostalCode) AndAlso PostalCode IsNot Nothing Then
            address &= "  " & PostalCode.ToString.Trim & vbCr
        End If
        If Not IsDBNull(Country) AndAlso Country IsNot Nothing AndAlso Country.ToString.Trim.Length > 0 Then
            address &= Country.ToString.Trim
        End If
        Return address
    End Function
  
    Public Shared Function GetLetterDate() As String
        Dim val As String = ""
  
        val = Now().ToString("MMMM d, yyyy")
  
        Return val
    End Function
  
End Class

The first function GetAddress takes several input parameters and builds an address.  The second function GetLetterDate() returns a date in the format (April 5, 2012).

This information I wanted to go into the Report Header section.  (Here is my mistake!!!)  Since I wanted the info of these 2 User Functions to show up side by side, I dropped a Table into the Report Header section of my Report.  I re-formatted the table to 1 row with 2 columns and entered the correct syntax for calling the user functions.  When I ran the report, my GetAddress function returned an empty string.  What was going on?

After wasting a decent amount of time, troubleshooting I finally figured out that the inputs to the GetAddress function were empty.  Why would the data source data be empty?  It wasn't when I passed it in.

Several days later (after solving the problem in a completely different way), I came across the following line in Telerik's documentation:

The Table report item is a separate data region and does not make use of the report's data source. It has its own Table..::.DataSource property which you have to set in order to populate the item with data.

And that was my whole problem!  I gave the Report a Data Source programmically.

Private Function ShowManagementLetterTest() As Telerik.Reporting.Report
    Dim showId As Integer = CInt(ID)
    Dim dtHdr As DataTable = csiShowDB.GetShowManagementLetter(showId)
    Dim report1 As New EmgLOSReports.TestReport1
    report1.DataSource = dtHdr
    Return report1
End Function

But I never gave the Table a Data Source (which can easily be accomplished with the following event code in the report itself)

Private Sub Table2_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles Table2.NeedDataSource
    If Table2.DataSource Is Nothing Then
        Table2.DataSource = Report.DataSource
        Dim dt As DataTable = CType(Report.DataSource, DataTable)
        TextBox10.Value = dt.Rows.Count.ToString
    End If
End Sub

Now, my whole problem started because I had carried over a style practice from web pages (using tables to line things up) to Telerik.Reporting (which does not need tables to align columns).

So, here were the learnings on my part...

  1. Make sure that your guidelines and practices apply to your environment  (I was in Telerik Reporting not web pages)
  2. Always keep in mind that there usually is a simpler way to solve your current dilemma (I didn't need tables to align items in Reporting)
  3. Telerik Reporting Tables require their own data sources!!!

I am attaching a PDF test report that shows the differences of using a Table with and without its' own data source.

Dennis
Top achievements
Rank 2
 asked on 05 Apr 2012
8 answers
219 views
Reporting 1.5

I have a letter style report with some data in the details section and several subreports.  Prior to any subreport, the details section has a report wide, "can grow" text box containing variable length summary text information.  When exporting to PDF, if the textbox is too long to be rendered completely on the first page, the report page breaks before the textbox rendering.  This leaves a large blank space on the first page.  The details section has Keeptogether explicity set to false.  Any ideas on how to cause this to be paginated correctly?
Mark
Top achievements
Rank 1
 answered on 05 Apr 2012
4 answers
272 views
Hiya.  I'm using Telerik Q3 2011 in Visual Studios 2010 on a machine running Windows 7.  I am new to Telerik and  learning the basics.  I am having trouble with the syntax for a parameter where multiple values will be allowed.  Currently I have the following in the sql query:

where a.problem_status in (:status)

This works fine if the parameter is set to single value.  However when I change the parameter to multi value and select multiple choices I get an error saying the sql query is not ended properly.

I have tried eliminating the parantheses with no luck.  I tried an = sign instead of "in" (not logical I know, but I tried it anyway), also without success.

Can someone tell me what I am doing wrong with the syntax?

Thanks!

Kevin
Kevin
Top achievements
Rank 1
 answered on 05 Apr 2012
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?