I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 .I want to display two more field to report(not available in data base table. I want to create these field by adding some data from existing field of data base table)
If you look at the .NET API exposed by Crystal Reports, you'll find that you can inject a DataSet into a report - this gives your application full control over the data used by the report, leveraging Crystal Reports as a presentation engine.
I've used this technique to generate reports over data soures not natively supported by Crystal Reports - it also helps to ensure that all the data comes from the sames source (as the API for changing the connection used within a normal Crystal report is somewhat flakey).
So, what I'd do in your situation is to load all the required data into a DataSet, add the extra columns, and then pass the dataset into the report. Only complex bit is that you need to save out the XML schema of the dataset and import it into Crystal Reports so that it is aware of the shape of your data.
You could use a crystal function also for this. Depending on how complex the calculation is from Column A to B. The more complex the easier it becomes just to do what Bevan says and change the dataset.
If you were more specific i might be able to give you some example code.
Use CR formula field.
Related
I would like to know whether it's possible to get hold of the data associated with a specific report. This also includes the schema of the data. In other words, if the report makes use of an Excel file, I would like to get hold of the data in that Excel file. Is something like this even possible? I have tried some of the methods, like GetDatasetAsync as well as GetDatasourcesAsAdminWithHttpMessagesAsync, but it did not provide the desired result.
Any assistance is greatly appreciated.
Thanks!
Here are the options I know of:
You can publish a PowerBI dataset and have other reports connect to it. You can find it on the list of connectors.
Exporting the data from the report (as csv). This only applies to the current visual.
You can export visual via PDF or PowerPoint.
XLMA Endpoints can let you query the model and retrieve what you want programmatically however this is a PREMIUM feature only. Here is a how-to.
You can build your model in analysis services (SSAS) and have a live connection to the tabular model, then you can work with the data in SSAS using XLMA.
That is about as good as it get's.
I have been given the task of taking Crystal Reports developed with the standalone version of SAP Crystal Reports (2013 SP 2 version 14.1.2.1121) and figuring out a way to deploy them without use of Crystal Reports Server. The data connection is already stored in the report so all I have to do is load the rpt file, pass in a parameter, and display the results.
I thought I could accomplish this in an asp.net application. I am using the following code to export straight to pdf so I don't have to deal with Visual Studio's crystal report viewer:
report.Load(Server.MapPath("CrystalReport1.rpt"));
report.SetParameterValue("Quarter End Date", parmDate);
report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "Report1");
This method works fine for all reports expect for two that contain a chart type of 'Date axis line chart'. When I run these reports through my web app the data fields match up exactly with the original report, but the charts are displaying wrong.
I have included two images below. The top is the proper rendering and the bottom is the rendering when running the report through my code.
I also tried to recreate the report from scratch in Visual Studio and, although the chart data was a little better, it was still off:
As I stated earlier, the report was given to me already completed. The question was could I could figure out a way to allow users to run it on demand supplying their own parameter from a browser without having to buy Crystal Report Server or some other tool.
There is another report that has a pie chart and it looks fine. Does anything have an idea of why this might be occurring?
Thank you.
Ultimately we had to downgrade the version these reports were created with to Crystal Reports 11.5. After that the charts rendered correctly.
Good afternoon, this is my problem.
I had created a datatable in C# with all the columns i needed, all this on runtime, and displayed all on a grid, all that works fine. Now my end user is asking me to put all that data on an report, but because this is not a table on the SQL i can't create a crystal report like i used to, making connections or using the wizard, so is there a way to create a crystal report or any other kind of report on runtime with autogenerated columns? I'm thinking on exporting to Excel too but i want to be sure i have no other option.
Thanks in advance and sorry for my english, is a little rusty.
most of the time we point store procedure or table and then SSRS report designer show us field and we just drag drop those field on to report designer surface. after all we call those report programmatically and pass parameter and report shown on report viewer.
now my company want that customer will customize the report who will see the report. they want to display all the fields in a form and just customer will select each field and place on report designer surface and give some input like filter condition like date range or employee id etc and report will be shown. also at run time if customer want they can add text or move existing field etc.
i do not have any idea how could i do this with SSRS. if this is possible with SSRS then please guide me in such a way as a result i can start the job or if possible give me few relevant url of that kind from where i can get the idea. thanks
SSRS is capable of reading reports generated on-the-fly, but they have to be made just right. SSRS reports are XML documents that specify the data structure and report object structures and how the two are related. Using Visual Studio, you can use certain classes to create the XML document which is then read & filled with data on the server, then exported to the client as a standard webpage.
Here is a link to a tutorial. This should be a good starting point.
Here is a small but working example of generating RDL on-the-fly with some useful links to MSDN documentation: "How to dynamically generate SSRS Report in Code"
Hope it helps!
I am working in visual 2008 with sql server 2005 as the back end. I am trying to create a crystal report with xsd file.This is what i did.
I created an empty xsd file from "Add New Items".i dragged the stored proc from the server explorer from the database which i want to attach to the crystal on to the xsd.
Created an empty crystal report,attached the xsd file on to the report through "Make new connection" and selected the fields which i want to display in the report.
Now when i do the print preview of the report is shows me the junk data and not the actual data that stored procedure returns.? I cant understand this behaviour.
Am i missing something?
Thats Crystal Reports for you. What you are describing is typical behaviour do not be alarmed. I have written a number of reports specifying a .xml or .xsd document as the data type(You need to remember to select ADO.NET from add connections for the following to work). When I go to run the report I simply specify the actual datatable that I get from SqlServer/Oracle/etc by doing the following
report.Database.Tables[0].SetDataSource(dataTable);
Like you in the preview pane I get bogus values even though my xml file may contain actual data along with the schema but when I actually run the Crystal Report I get the expected out put.