cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal reports and WCF Data Services (OData)

Former Member
0 Kudos

How I can connect with Crystal Reports 2008 SP 3 to WCF Data Service (OData) for gathering data?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sulmar,

Licky you, I just worked with this...

I assume that you are working in .NET / Visual Studio - right? First you have to create a DataSet in your project, defining your data model. Based on this DataSet you can build your CR with the DataSet as data source.

After this you have to map your incoming data from OData service to your DataSet. this can be done simiar to the following example where I map data from the SFlight data model to the DataSet which is the base for my CR:

static private void generateCRFlight(DataTable inDataTable)

{

//Create data set to be consumed by crystal report

DataSetFlight dataSetFlight = new DataSetFlight();

DataTable theDataTable = dataSetFlight.Tables.Add(("FlightData"));

theDataTable.Columns.Add("CarrID", Type.GetType("System.String"));

theDataTable.Columns.Add("ConnID", Type.GetType("System.String"));

theDataTable.Columns.Add("FlDate", Type.GetType("System.DateTime"));

theDataTable.Columns.Add("Price", Type.GetType("System.Decimal"));

theDataTable.Columns.Add("Currency", Type.GetType("System.String"));

theDataTable.Columns.Add("PlaneType", Type.GetType("System.String"));

theDataTable.Columns.Add("SeatsMax", Type.GetType("System.Int32"));

theDataTable.Columns.Add("SeatsOcc", Type.GetType("System.Int32"));

int rowCounter = 0;

int numberOfRows = inDataTable.Rows.Count;

for (rowCounter = 0; rowCounter < numberOfRows; rowCounter++)

{

DataRow theDataRow = theDataTable.NewRow();

theDataRow[0] = inDataTable.Rows[rowCounter][0];

theDataRow[1] = inDataTable.Rows[rowCounter][1];

theDataRow[2] = inDataTable.Rows[rowCounter][2];

theDataRow[3] = inDataTable.Rows[rowCounter][3];

theDataRow[4] = inDataTable.Rows[rowCounter][4];

theDataRow[5] = inDataTable.Rows[rowCounter][5];

theDataRow[6] = inDataTable.Rows[rowCounter][6];

theDataTable.Rows.Add(theDataRow);

}

CRFlight theCrystalReport = new CRFlight();

theCrystalReport.SetDataSource(dataSetFlight.Tables[1]);

ReportViewer theReportViewer = new ReportViewer(theCrystalReport);

theReportViewer.Show();

}

see as well the follwoing article: [Creating Crystal Reports using C# with Datasets|http://www.codeproject.com/KB/cs/CreatingCrystalReports.aspx]

0 Kudos

Hello,

What is WCF Data Services (OData)? Is this a classic SAP data source? If so please mark this as answered and post your question to the Integration Kit forum:

Or one of the SAP forum, not Crystal Reports. Be sure to specify the version of Crystal Reports you are using.

Thank you

Don

Former Member
0 Kudos

The Open Data Protocol (OData) is a Web protocol for querying data. (http://www.odata.org/)

WCF Data Services is implementation of OData protocol by Microsoft.

Crystal Reports 2008 SP 3 has just support WCF Services. I think that is good idea to add support OData to Crystal Reports.

IMO this forum is good place for this subject.

Former Member
0 Kudos

I am really interested in support for OData in Crystal Reports - could anybody from SAP comment on whether progress was made on this? Would that relate to "Project Gateway" in one way or another?

0 Kudos

Hello,

We don't specifically have a driver for it. As a work around create a report off the ADO.NET driver to use a record set and then move the WCF data into the DS. Then CR can use it.

Add your request to the Idea Place, if it gets enough votes Product will look into adding it as a supported data source.

I'll get one of the PM for Cr to look at this post and comment on the functionality...

Thank you

Don