5

Ok, so I'm building a kind of reporting central for the company I work at and the easy part was building a web based file browser, now I'm moving on to the report aspect of it and to start it off, I'm integrating Crystal Reports. I've already gotten the files from the SAP website for them, but I'm encountering a couple problems,

First off, all the examples I've found make it so that you have to define the data source/database, and include log in information for it in the code. This is a problem because we have a LOT of crystal reports, with a lot of different database references, so I can't just use one for all of them. In fact, there are reports that we use that reference multiple database at the same time.

Secondly, all the examples I've found make it seem like you have to have a specific page created for each report. My goal is to be able to have the report link as a variable and have one page for all of the reports we have.

I looked at everything I could find yesterday and I couldn't find what I needed. I'm also wondering what on earth the ReportClass.Load function even does. It was in every example I could find and I didn't notice any explicit difference in the ReportClass I had when I used it.

While searching, I found an answer that suggested building a web forms application that would build the Reports, and then use an I-Frame to grab it, but that's something I want to avoid.

So in review:

1) I need to build Crystal Reports without having to reference the Database

2) I need it to be flexible to a variable Report by supplying just the path to the .rpt file

3) I would like it to be in a single application, in MVC, and avoiding IFrames

Thank you so much for your help!!

EDIT: I found a solution that works for me. Instead of using a RAZOR view, I used an ASPX view, which has the Crystal Reports Viewer Tool in the toolbox. In order to make it variable I used the ViewBag.

Controller Code:

[HttpGet]
    public ActionResult Viewer(string Path)
    {
        var sessionID = Session.SessionID;
        ViewBag.Path = newPath;
        return View();
    }

ASPX View Code:

    <% Report.Report.FileName = ViewBag.Path; %>
    <CR:CrystalReportViewer ID="Viewer" runat="server" AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="100%" ReportSourceID="Report" ToolPanelWidth="200px" Width="100%" />
    <CR:CrystalReportSource ID="Report" runat="server">
        <Report></Report>
    </CR:CrystalReportSource>
tereško
  • 58,060
  • 25
  • 98
  • 150
Charlie Pugh
  • 342
  • 2
  • 18
  • I would love to, and that may be a good solution from now on, in fact I plan on adding functionality for SSRS reports as well as Excel reports in the final project, but we already have literally hundreds of Crystal Reports already made, I'm just making the viewer for them. To try to redo them would take way too long. We're moving more towards SSRS reports now, but we still need a vast majority of the reports we already have in Crystal. And thank you for helping!! – Charlie Pugh Jan 04 '12 at 17:51
  • Yeah, I overlooked the part of your post about the existing reports, so I deleted my comment :) – HardCode Jan 04 '12 at 17:56
  • I don't know about points 2 and 3, but point 1 isn't possible in Crystal, or SSRS, or any other report designer I know - how are you supposed to add fields to a report if you have no way of determining waht those fields are? (You should be able to *amend* the layout of existing reports without access to the database, but not build them from scratch.) –  Jan 05 '12 at 08:15
  • Because the info about the database _should_ be stored in the crystal report itself. Therefore I shouldn't need to tell it where to look or any log in info. – Charlie Pugh Jan 05 '12 at 16:47

2 Answers2

0

A "similar" (not exact) question was asked here. Hopefully that can get you down the right path.

Community
  • 1
  • 1
rlcrews
  • 3,482
  • 19
  • 66
  • 116
0

1) I need to build Crystal Reports without having to reference the Database

Have you considered building a data warehouse for your reporting and analysis needs? A data warehouse has many benefits over a traditional reporting structure especially when drawing data from multiple sources.

In regards to point 2 & 3 have you considered that crystal reports may simply not be the most ideal reporting solution?

Crystal reports is a powerful tool but honestly I'm not a big fan of it when it comes providing reporting intelligence over the internet or an intranet.

Having you considered switching tools? For example http://www.tableausoftware.com/ provides some excellent data visualization tools and IMO is a much better tool for the job you are describing.

Note, that this is simply one tool (as there are many out there), but one that I have had some experience with and it exceeded our expectations especially when sitting on top of a data warehouse.

Jesse
  • 8,223
  • 6
  • 49
  • 81