This is a migrated thread and some comments may be shown as answers.

Trying to add a CrossTab to a report

7 Answers 343 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 20 Dec 2012, 09:07 PM
In what section of the report should a CrossTab be added?

In Crystal, we have the following CrossTab we need to convert.

{Fields.DSort1[Sort/Hidden]} Total
{Fields.A1[Display]}
{Fields.A7} {Count(Fields.A7)} {Count(Fields.A7)}
Total {Count(Fields.A7)} {Count(Fields.A7)} Is the above doable?  You provide for 4 boxes with optional groups for a crosstab.

I have tried placing the crosstab in various sections, and in all cases, the generation hangs for about 5 to 10 seconds and then renders an around 27 page report   The Crystal Reports version is only a few lines.  I have attached the result from Crystal.


We also want to pass the "Total" phrase as a field for language translation.

Peter

7 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 26 Dec 2012, 02:48 PM
Hi Peter,

The section in which you put the Crosstab should make no difference. The Crosstab is a Data Item and has its own DataSource which means that its layout should not be dependant on the parent item. 
The following resource can help you get started with the Crosstab item:

Greetings,
Elian
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Peter
Top achievements
Rank 1
answered on 26 Dec 2012, 03:34 PM
 
It automatically assigned the same datasource as the main report.

However, I did have an extra grouping in my cross tab, but I still can't get the data to show.

Do you have a downloadable sample so I can review the code as it is defined?

Edit:  I tried having 2 datasources, one for the report and one for the crosstab.  I also tried recreating the cross tab with the wizard.  The result is shown in capture.jpg, it acts as though the crosstab isn't getting any data.  I also attached (crosstab.jpg) what it looks like within the designer.  I want to replace the "Total" phrases with fields from the recordset. 
0
Stef
Telerik team
answered on 28 Dec 2012, 12:19 PM
Hello Peter,

The demo Product Sales per Period is also available on your machine under C:\Program Files (x86)\Telerik\Reporting Q3 2012\Examples. You can also check the video tutorial how the demo was created. You will find more information what data structure and how to place it in the Crosstab item in the following article from our online help: Understanding Crosstab areas. Please, notice that the displayed text in the Crosstab item depends on your input.
About having completely different data source for your report, you can use the created Crosstab report as a Subreport item in it, separating data. More details on creating Master-Detail Reports in this video: Reporting Subreports.

I hope this helps.

Regards,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Peter
Top achievements
Rank 1
answered on 28 Dec 2012, 01:06 PM
I have reviewed the samples and the videos but it is still not helping me get the Cross Tab to work in my situation.

My report is getting data but the Cross Tab is not.  I want to be able to have a Cross Tab in each group unique to each group, with a column group and a row group.  But then I want a final cross tab in the report footer that shows just a set of totals by my column groups.

Is more than 1 Cross Tab allowed in a report?

Thanks
0
Stef
Telerik team
answered on 02 Jan 2013, 02:45 PM
Hi Peter,

Yes, you can use more than one Crosstab in your report as you provide well structured data in the right place. The example from this forum thread can give you ideas: Crosstab and groupings. You can add another Crosstab in the Report footer with other data source or the current report data source.
In order to help you, please further elaborate on your case:
  • What is the data structure? 
  • What is the grouping criteria?
  • What should be displayed in the crosstab?
  • What should be in the Report Footer?

All the best,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Peter
Top achievements
Rank 1
answered on 02 Jan 2013, 03:34 PM
I figured out the problem.  I am dynamically running the report by passing a DataTable to the report, as shown below:

    Public Shared Function GeneratePDF(reportDoc As Object, dtData As DataTable) As Byte()
        Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
        Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()

        reportDoc.DataSource = dtData
        If reportDoc.CrossTab1 IsNot Nothing Then
            reportDoc.CrossTab1.DataSource = dtData
        End If

        instanceReportSource.ReportDocument = reportDoc

        Dim reportResults As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, Nothing)

        Return reportResults.DocumentBytes
    End Function

I had to add the bold/italic code above in order for the CrossTab to get the data.  How can I dynamically make sure the main report passes the data to the cross tab?

Thanks

Peter
0
Stef
Telerik team
answered on 04 Jan 2013, 02:14 PM
Hello Peter,

I am glad to hear you have managed to solve the issue.
About your question, you can use the Crosstab NeedDataSource event to set the Crosstab data source to the report data source.

Let us know if you need more help.

All the best,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Elian
Telerik team
Peter
Top achievements
Rank 1
Stef
Telerik team
Share this question
or