Thus far, the chapters on the Crystal Enterprise Object Model have focused on delivering relational Crystal Reports. This section discusses delivering Crystal Analysis reports in custom Web applications.
Crystal Reports can report off OLAP data sources such as Microsoft SQL Server Analysis Services as well. However, Crystal Reports provides OLAP Reporting as opposed to what Crystal Analysis provides, which is OLAP Analysis. If all you need is to view snapshots of a cube's data, Crystal Reports is the best solution. However, the real power of building OLAP cubes is in the explorative analysis that can be performed. Instead of simply answering the "what" and "when" and "who" questions, that OLAP analysis provided by Crystal Analysis can answer the "how" and "why" questions.
Discovering Crystal Analysis Reports
The first thing you should understand when learning about working with the Crystal Enterprise object model and Crystal Analysis is that the Crystal Analysis report files (.car files) are hosted as InfoObjects just like all other objects in Crystal Enterprise. The object type for these reports is CrystalEnterprise.Analysis. The following is an InfoStore query that returns all Crystal Analysis reports stored in a given system:
SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Analysis'
As you can see the SI_ID and SI_NAME properties apply to Analysis reports the same way as they do to Crystal Reports. Some other InfoStore properties that are applicable to Crystal Analysis are
Unlike Crystal Reports, Analysis reports cannot be scheduled. However, a user can create a saved view of a Analysis report. A saved view is simply a certain viewpoint and state of the report that is saved as another InfoObject. Like Crystal Report instances, saved views are children of the original report in the Crystal Enterprise repository. The following query would be used to return only reports and not saved views:
SELECT SI_ID FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Analysis' AND SI_SAVED_VIEW=0
Notice that the SI_SAVED_VIEW property is used much the same way as the SI_INSTANCE_OBJECT property is used for Crystal Reports.
Unlike Crystal Reports, Crystal Analysis does not have the corresponding object or component that is used to view reports. Instead reports are viewed by redirecting to a URL with a certain syntax that indicates which report to view and some other information. This URL is handled by the Web Component Server, which calls out to the Crystal Analysis engine to display the report. This ends up being a much easier solution anyway. The report can be loaded into a frame if needed as well. The URL used to view Crystal Analysis reports is as follows:
This infoobject.cwr URL accepts the following arguments along the query string:
Any of these items can also be passed via an HTTP form post to hide their values from the end user.
A sample URL is provided here:
Figure 36.6 shows the result of this URL.
Figure 36.6. Viewing a Crystal Analysis report.
Passing Parameters to Crystal Analysis Reports
A new feature to Crystal Analysis is parameterized reports. A parameter can be used to set the cube location, page, member set, or member. When viewing a report that has a parameter defined and using the URL from the previous example, the Crystal Analysis report viewer would pop up a message asking the user to type in a value for the parameter. Often it's preferable to bypass that parameter prompting screen and pass the parameter value to the viewer directly. This is done via the promptex query string item.
The syntax for the promptex query string item is as follows:
Single value: promptex-NAME=VALUE
Multiple value: promptex-NAME=KEY%3DVALUE,KEY%3DVALUE,...
For single value parameters, use the first syntax, replacing NAME with the name of the parameter as defined in the Crystal Analysis designer, and VALUE with the value required. The following example would pass the value 2004 to the Year parameter:
Some other examples are listed here: