Telerik Forums
Reporting Forum
1 answer
85 views
Hi,


I wanted to computed a defined formula for a cross tab how is it possible to derive my desired result?
See attach image for further detail.
Stef
Telerik team
 answered on 22 Jan 2014
1 answer
169 views

In the sample code below is there a way to tell how many pages exported the pdf has?

Public Sub CreateProcessNotesPDF()
    Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
    instanceReportSource.ReportDocument = New ProcessNotes
    instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("ProcNo", _procNo))
    instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("ApplicantName", _applicantName))
    Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
    'set any deviceInfo settings if necessary
    Dim deviceInfo As New System.Collections.Hashtable()
    Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo)
    Dim fileName As String = result.DocumentName + "." + result.Extension
    'Dim path As String = System.IO.Path.GetTempPath()
    Dim path As String = System.IO.Directory.GetCurrentDirectory()
    Dim filePath As String = System.IO.Path.Combine(path, fileName)
    Using fs As New System.IO.FileStream(filePath, System.IO.FileMode.Create)
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length)
    End Using
End Sub


Nasko
Telerik team
 answered on 22 Jan 2014
6 answers
1.6K+ views
Hi,

I'm using the ReportProcessor class in order to export reports in an HTML format progmmatically.  I have a couple of questions; I'm about at wit's end, here.

I have a report which contains a sub report.  Each of these reports is encapsulated in a TRDX file.  I create an instance of the main report (let's call it MainReport), which is of type Telerik.Reporting.Report.  I get a reference to MainReport's DataSource property, which is a SqlDataSource, and I set the ConnectionString property to a connection string in my app.config file.  I then instantiate an InstanceReportSource and set the ReportDocument property to my MainReport object.  At this point, I can render the main report via the ReportProcessor.RenderReport method.  All is well and good so far.

My problem is with the sub report.  What do I need to do to include it?  I've looked at the limited amount of documentation over and over but I simply cannot wrap my head around what I need to do.  Here's what almost works:

I create an instance of the sub report the same way I'm instantiating MainReport (we'll call it SubReport).  I then Find() the sub report item within MainReport's Items collection, and after grabbing that reference, I set its ReportSource property to my SubReport instance.

Here's the problem with that:  Apparently this way of doing things is obsolete.  I need to know how to do it correctly.  Also, I need SubReport.DataSource.ConnectionString to be the same as MainReport.DataSource.ConnectionString.  Additionally, there is a Crosstab item within the main report that apparently also needs a ConnectionString, even though the DataSource is the same as MainReport's DataSource.

Here's some code snippets:

//MainReport instantiation  (some code is hidden, but you should get the idea
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreWhitespace = true;
ReportXmlSerializer serializer = new ReportXmlSerializer();
XmlReader primaryReportXmlReader = XmlReader.Create(reportDefinition.PrimaryReport.TemplateLocation, xmlReaderSettings);
_primaryReport = (Telerik.Reporting.Report)serializer.Deserialize(primaryReportXmlReader);
primaryReportXmlReader.Close();
             
SqlDataSource reportDataSource = (SqlDataSource)_primaryReport.DataSource;
reportDataSource.ConnectionString = reportDefinition.ConnectionString;
this._instanceReportSource.ReportDocument = _primaryReport;

//We're using a custom class to define a "report definition", which contains data about sub reports,
//so I'm looping through each sub report definition and instantiating it.
foreach (CPSReport cpsSubReport in reportDefinition.SubReports)
{
    XmlReader xmlReader = XmlReader.Create(cpsSubReport.TemplateLocation, xmlReaderSettings);
    Telerik.Reporting.Report subReportInstance = (Telerik.Reporting.Report)serializer.Deserialize(xmlReader);
    xmlReader.Close();
 
    SqlDataSource subReportDataSource = (SqlDataSource)subReportInstance.DataSource;
    subReportDataSource.ConnectionString = reportDefinition.ConnectionString;  //would be handy to automatically get from the main report
    //The following line is hardcoded for now because i've been experimenting.  The string "subReport1" would actually be defined in our custom report definition class.
    Telerik.Reporting.SubReport subReport = _primaryReport.Items.Find("subReport1", true).FirstOrDefault() as Telerik.Reporting.SubReport;
    subReport.ReportSource = subReportInstance;  //obsolete.  what's the right way to do this?
}

Also, as I mentioned, in the rendered report, I get an error about the Crosstab connection string:

An error has occurred while processing Table 'crosstab2': 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 ------------- Format of the initialization string does not conform to specification starting at index 0.

Please help?  :)

Thanks!
Steve
Top achievements
Rank 1
 answered on 22 Jan 2014
1 answer
230 views
I must be dense or something, but for the life of me, can't figure out how to get a report viewer control to display a report.
I need to dynamically set the report location and SQL server connection string in the code behind. The reason for this is,
I want to call the report viewer from multiple areas in my asp.net application and populate it with different reports. Also, the
SQL connection string resides in the web.config and is encrypted. I need to decrypt the string before passing it on to the
report to use. Some reports are single layer and others have sub-reports in them.

So, how do I do this in the code behind of a web form? Source code example would greatly be appreciated.

Thanks!
Stef
Telerik team
 answered on 21 Jan 2014
1 answer
82 views
I have a group (county) which can have data or be empty.  How can I change the group expression, to group data when group field is empty, and group matching criteria.  Is there a way to add a second grouping to a group and change "IsEmpty" to true?

- Thank you for the help, Bryan.
KS
Top achievements
Rank 1
 answered on 21 Jan 2014
1 answer
198 views
Hi there,

we are evaluating telerik reporting engine!

We want to generate reports that should be printed automaticly to a networkprinter. I coded this (VB.net and WinForms) from the examples here:

http://www.telerik.com/help/reporting/m_telerik_reporting_processing_reportprocessor_printreport.html



The printer itself is a tool which analyses the document and depending on its content adds some barcodes. But this does'nt work. Because the Printer gets an image with a lower resolutions as needed, the OCR of the tool didn't recognizes anything und the workflow fails.

Is there a way to solve this problem?

Even if I Export the Report first to PDF the OCR fails. The only way is to Export it as RTF and then print it from MS Word, but this is not applicable on all Clients!

Regards

Torsten

Stef
Telerik team
 answered on 21 Jan 2014
4 answers
116 views
Hi All,

I use a crosstab on my report. And I need 13 columns, regardless of how much column binded.

Is there a way to do it?

Example is drawn in paint 
Mustafa
Top achievements
Rank 1
 answered on 21 Jan 2014
1 answer
117 views
The reports we are using in our project have a  main report and couple of sub reports embedded within them. The report dll we are using is Version 6.2.12.1017. We are using report viewer for Silverlight for displaying the report.
The default language for the reports are English(US). When a report is loaded in the report viewer for the 1st. time, all the localizations take effect perfectly.

But, if the same report is refreshed or regenerated for some new parameter (not the 1st, time load) it fails to localize properly. In this case (refresh or change in parameter) only the sub reports are displayed with the right language. But the label texts in the main report show up in the default language.

I have checked on the server side where report is generated that the current culture of the thread is correct (not the default English). Yet, the conversion does not take effect in only the main report texts even though the sub reports embedded within it work perfectly.

Our product is already in Beta phase. Hence, we are in urgent need of resolution for this. Hope, you can help us with this.

Regards,
Stef
Telerik team
 answered on 20 Jan 2014
1 answer
159 views
Hi,

I created a report category which include a list of reports. I can link to a report, for example report A. However if I also have a textbox in report A
 whose action links to another report B, I cannot link to B. The cursor is not like hand.

Report preview all works fine. It just doesn't work when displaying report from html5 report viewer. Do I have anything wrong?

Thanks.

Amber
amber
Top achievements
Rank 1
 answered on 17 Jan 2014
7 answers
582 views
I have a nice table all nicely formatted with one slight flaw. I have the column headers coloured blue and the a dark blue shaded top border and bottom border on the column headers. Now to make the table easier to read I used the conditional formatting to change every other row background colour to grey. It works beautifully except for one slight flaw, if the alternate row is at the top of the page the bottom border edge of column header row becomes extremely thin. So I thought if I could make an additional conditional formatting rule to account for the first row it would fix the issue however I can't seem to find of way of telling which row number starts at top of the page.

I have my table in the group header section so that I can get my headers on every page and also so that I can group based on a column in the report and page break every time a new code is found. I was thinking I could also limit the number of rows per page so that it would fix that way making sure an even number of rows the issue would never happen. I attempted to do this, however I wasn't able to combine the two conditions, I keep getting error saying I can't have aggregate function in the group filter I was attempting to add "Int((RowNumber()-1)/30)"  to my existing group which is in the form = Fields.someField.

Any help would be greatly appreciated.
Stef
Telerik team
 answered on 17 Jan 2014
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?