How to create custom reports using Crystal Reports

If Crystal Reports is installed on your computer, you will be able to create custom reports in the Administration and Monitoring Console.

Important! Crystal Reports must be installed on the same computer as the Application Server.

Crystal Reports setup

ABBYY FlexiCapture supports Crystal Reports for Visual Studio 2010 (Version 13, 13.0.11.1467 is recommended), Crystal Reports 2008 (Version 12), Crystal Reports for Visual Studio 2008 (Version 10.5).

Note. If you are using Crystal Reports for Visual Studio 2008 (Version 10.5) and Internet Explorer 11, enable Compatibility View in Internet Explorer.

Whether to install a 32- or 64-bit version of Crystal Reports is determined by the mode, in which the pool of the Administration and Monitoring Console is running in IIS (FlexiCapture 11 Monitoring).

Note. If the bit does not match or Crystal Reports is not installed, the following error message will appear:

A runtime error occurred:
CrystalReports loading failed

Details:
Description Exception has been thrown by the target of an invocation.
Source mscorlib
Stack trace at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at ReportManager.loadCrystalReports()

To use Crystal Reports for generating reports, specify the following key in the web.config file of the Administration and Monitoring Console:

<appSettings> <add key="UseCRReportSystem" value="true"/> ... <app Settings>

Crystal Report Query

To create a custom report, complete the following steps:

  1. Create a new Visual Basic Class Library in Microsoft Visual Studio:
    • In the main menu, click File > New Project.
    • Chose Other Languages > Visual C# > Windows in the Project Types panel and Class Library in the Templates panel.
      NewProject.gif
    • Add a Crystal Report template to the project.
    • In the main menu, chose Project > Add New Item.
    • Chose Visual C# Items > Reporting in the Categories panel and Crystal Report in the Templates panel.
      NewReport-2.gif
  2. Depending on the type of report you chose, do one of the following:
    • For an SQL or stored procedure based report

      Important! Crystal Reports represents data received from SQL queries or stored database procedures as data sets. If you plan to use a stored procedure, you must create one and save it in the database of ABBYY FlexiCapture in advance.

      1. Add a DataSet to the project. 
        • Choose Project > Add New Item in the main menu.
        • In the Categories panel, chose Visual C# Items > Data, in the Templates panel, chose DataSet.
          NewDataset.gif
      2. Use DataSet Toolbox or Server Explorer to access the database server of ABBYY FlexiCapture and transfer the necessary data to the data selection tab. 
        • In the main menu, choose View > Toolbox or View > Server Explorer to display the corresponding windows.
          Toolboxes.gif
        • Transfer the necessary data to the data selection tab.
          DatasetReady.gif
      3. Add the data to your report. 
        • Open your report in Crystal Reports and chose Crystal Reports > Database > Database Expert in the main menu.
        • In the Available Data Sources panel, chose Project Data > ADO.NET DataSets > <DataSet Name> and click the > button.
          ConnectDataset.gif
    • For a report created in Crystal Reports

      1. Use Database Expert in Crystal Report's report editor to connect to the database by selecting OLE DB (ADO). 
        • Open your report in Crystal Reports, then chose Crystal Reports > Database > Database Expert in the main menu.
        • In the Available Data Sources panel, chose Create New Connection > OLE DB (ADO).
          SelectADO.gif
          Then setup a connection to the database.
      2. Use Database Expert to create a database query command by specifying the database's text and parameters. 
        • After you connect to the database, chose Add Command and click the > button.
          AddConnection.gif
        • Enter your query and specify its parameters.
          AddCommand.gif
  3. Create the report.
  4. Save the report.

Now when you generate this report it will be displayed in Crystal Report Viewer and you will be able to export it to various formats.

Custom reports

Custom reports are divided into two types according to the method of acquiring data:

  1. Reports based on queries created in Crystal Report Query Editor.
  2. Reports based on data acquired from stored procedures or on SQL queries to the database.

Both types of reports will be displayed in Crystal Report Viewer.

A custom report containing the first 100 records from the log would include the following files:

In order to enable a custom report, place the report (*.rpt) and the report's XML file in the FlexiCapture11\CustomReports subfolder of the IIS root folder (usually C:\Inetpub\wwwroot\FlexiCapture11\Monitoring\CustomReports), and then enable it through the Administration and Monitoring Console. Examples of custom reports are placed in this folder when FlexiCapture is installed. When you enable your report, it will become available in the Custom reports submenu of the Administration and Monitoring Console.

Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed