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

how do I create a report with scattered data

9 Answers 145 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wadigzon
Top achievements
Rank 1
Wadigzon asked on 01 Feb 2013, 11:00 PM
My report will not be the typical one whereby I have fixed columns and x amount of rows (depending on the amount of
data from a SQL source), I need to create a report with these requirements:
- it will have a fixed amount of pages, say 15 pages
- each page has a different user interface (say checkboxes, frames, text boxes, labels, circles, squares, etc)
- the data for these pages will come from a data source (that's the only similarity with the old one)

I know this have to be done programatically and NOT using the wizard, my question is how (give me a hint)?

can you provide an example of creating say a text box, a field, adding a page, a label and what not on certain page?
and hooking this textbox with a data source.
regards

9 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 06 Feb 2013, 02:27 PM
Hi Wadigzon,

The detail section repeats items from a bound data in the specified template. If you intend to use one report definition, that means only one template (detail section) will be available. Having in mind the principle of work is like a repeater i.e. the detail section is repeated for each record, creating predefined number of pages with different layout is least to say very tedious work.
In addition, changing the report definition once processing has started is not recommended, so the right way to have 15 different layouts as one is creating 15 different report definitions which will be gathered in one ReportBook control. For more details about using ReportBook, please check the ReportBook example installed under C:\Program Files (x86)\Telerik\Reporting Q3 2012\Examples on your machine. The data source for all reports can be set to the reports before adding them to the ReportBook.

In short, Telerik Reporting or any reporting product in general is not the right choice for your scenario, where you tend to create a document similar to word processing products where each page can be individually designed and different from previous/next.

I hope this helps.

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
Steve
Top achievements
Rank 1
answered on 06 Feb 2013, 04:29 PM
Hi

I have a different question. I am new to Telerik reporting. Actually, I am binding the data to the report viewer by using the Telerik report wizard where we can set the stored procedure name. By using this way I am able to bind. But, I don't want to use by this way. I want to bind the data using pro-grammatically in the code behind with the dataset. The output to my stored procedure is XML, so I am converting the xml into dataset. Now, I am binding that dataset to report viewer, but it's not.
For testing purpose, I have binded the dataset to gridview and it's showing me all the data. But, I am not able to do the same with the report viewer.
Dim dsSelected As New DataSet
            Dim xNodeList As Xml.XmlNodeList = xmlDocument.GetElementsByTagName("detail")
            Dim xReader As Xml.XmlTextReader
            Dim x As Integer
            For x = 0 To xNodeList.Count - 1
                xReader = New Xml.XmlTextReader(xNodeList.Item(x).OuterXml, Xml.XmlNodeType.Element, New Xml.XmlParserContext(NothingNothingNothing, Xml.XmlSpace.None))
                dsSelected.ReadXml(xReader, XmlReadMode.InferSchema)
            Next x
  Dim objectdatasource As New Telerik.Reporting.ObjectDataSource()             objectdatasource.DataSource = dsSelected                 Dim report As New Telerik.Reporting.Report()             report.DataSource = dsSelected                 Dim source As New Telerik.Reporting.InstanceReportSource()             source.ReportDocument = New Report1()             ReportViewer.ReportSource = source             ReportViewer.DataBind()

0
Johannes Deetlefs
Top achievements
Rank 1
answered on 06 Feb 2013, 05:15 PM
Thanks Steff, that ReportBook and the samples you pointed out certainly help. I am playing with them as I type this, I think the ReportBook is what I am trying to accomplish. appreciate your input.
0
Stef
Telerik team
answered on 07 Feb 2013, 03:31 PM
Hi guys,

@Steve:You are on the right way using objectDataSource. Please, take a look at this help article elaborating on the needed settings to work with DataSet objects: How to: Bind to a DataSet.

@Johannes: glad that our suggestion helps.

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
Steve
Top achievements
Rank 1
answered on 07 Feb 2013, 03:39 PM
Hi

I have done the same thing. I can see the dataset data at run-time. But, I am not able to bind to the report viewer pro-grammatically.
I have binded that to a Gridview and it's working. I have sent my code in my earlier post. Can we bind a pro-grammatically returned dataset to a telerik report viewer ? 

Appreciate your help on this..
0
Stef
Telerik team
answered on 08 Feb 2013, 08:54 AM
Hello Steve,

Please test the following code in your project:
' Creating and configuring the ObjectDataSource component:
       Dim objectDataSource As New Telerik.Reporting.ObjectDataSource()
       ' GetData returns a DataSet with three tables
       objectDataSource.DataSource = GetAllData()
       ' Indicating the exact table to bind to. If the DataMember is not specified the first data table will be used.
       objectDataSource.DataMember = "SomeTableNameFromTheDataSet"
 
       'Create instance of your report
       Dim report As New MyReport()
       'assign the data source to the report
       report.DataSource = objectDataSource
 
       'create report source instance for the ReportViewer
       Dim source As New Telerik.Reporting.InstanceReportSource()
       'set your report as document for that report source instance
       source.ReportDocument = report
       'display the report in the ReportViewer
       ReportViewer.ReportSource = source
In general, you need to specify which table will be used from the DataSet, setting the DataMember of the objectDataSource, then this data component should be set as DataSource for an instance of your report definition.

I hope this solves the issue.

Kind 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
Steve
Top achievements
Rank 1
answered on 08 Feb 2013, 03:10 PM
Thank you for your response.. It's working with sample dataset(I mean, I have set the connection string, fill the dataset using datadpter etc in my coed-behind). I have sent you the code earlier, I am actually converting the stored proc output xml into a dataset and then I am using the procedure which you have replied. But it's not. Do you mind seeing my earlier post where I am actually converting. Probably, I might using the wrong way...Anyways, I am gonna send you the code again for your convenience.

'This is my stored procedure name "RptCashManagementBatchAU" which is returning xml.
 libweBroker is used in our project for the connection string information and from there we are calling the stored procedure.
	    Dim rslt As Hashtable = libWebBroker.clsWebBroker.RptCashManagementBatchAU(StartDate, EndDate)
dsXML.LoadXML(CType(rslt("RptCashManagementBatchAU")(0), System.Xml.XmlDocument).OuterXml)             Dim xmlDocument As New XmlDocument()             xmlDocument.LoadXml(CType(rslt("RptCashManagementBatchAU")(0), System.Xml.XmlDocument).OuterXml) 'Converting the stored procedure output xml to a dataset.             Dim dsSelected As New DataSet             Dim xNodeList As Xml.XmlNodeList = xmlDocument.GetElementsByTagName("detail")'Childe node.             Dim xReader As Xml.XmlTextReader             Dim x As Integer             For x = 0 To xNodeList.Count - 1                 xReader = New Xml.XmlTextReader(xNodeList.Item(x).OuterXml, Xml.XmlNodeType.Element, New Xml.XmlParserContext(NothingNothingNothing, Xml.XmlSpace.None))                 dsSelected.ReadXml(xReader, XmlReadMode.InferSchema)             Next x
'creating the instance for the objectdatasource and then binding the resultant dataset.
            Dim objectDataSource As New Telerik.Reporting.ObjectDataSource()             objectDataSource.DataSource = dsSelected             Dim report As New Report1()             report.DataSource = objectDataSource             Dim source As New Telerik.Reporting.InstanceReportSource()             source.ReportDocument = report             ReportViewer.ReportSource = source

I don't think I need to specify the datamember here as my dataset is only returning one table. I have also used by assigning the datamember, but still it's not working.
0
Steve
Telerik team
answered on 08 Feb 2013, 04:54 PM
Hello Steve,

We've already addressed your inquiry in the other forum thread you have hijacked. Here is our answer:

You instantiate Report1() class, but is that report bound and created by you beforehand? Grid controls are not appropriate comparison, as most of them have the automagical "AutogenerateColumns" property that would iterate your datasource and create columns from it. This would not happen for a template component like Telerik Report, you should create the layout yourself either by manually laying out report items or use the Report Wizard to create the report. See Creating a Simple Report for more information.

If you still need help, it would be best to open a support ticket and attach a project that exhibits the issue, so we can help you accordingly.

All the best,
Steve
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
Wadigzon
Top achievements
Rank 1
answered on 08 Feb 2013, 05:24 PM
just FYI Johannes and I belong to the same team. Thanks!
Tags
General Discussions
Asked by
Wadigzon
Top achievements
Rank 1
Answers by
Stef
Telerik team
Steve
Top achievements
Rank 1
Johannes Deetlefs
Top achievements
Rank 1
Steve
Telerik team
Wadigzon
Top achievements
Rank 1
Share this question
or