Sharing Components in the Repository


Imagine the real-life situation where an organization has thousands of Crystal reports, some of which have a copyright notice on the bottom of each page. The legal department decides it wants to change the verbiage on this copyright notice. The administrator faces three problems: which reports have this notice, how to make this change in a timely fashion, and how to effectively make these types of changes in the future.

Without having the ability to check commonly used components into the repository, the administrator would have the unfortunate task of checking each report for the copyright notice and making the change on each report individually.

To solve this problem, Crystal Report developers should store and reuse commonly used components in the repository.

These components include

  • Text objects Reusable text, such as company addresses or confidentiality text.

  • Images Bitmaps, metafiles, TIFF, JPEG, and PNG image formats.

  • Custom functions Business logic that could be reused by passing in new fields as variables.

  • SQL Commands Encapsulated SQL Commands enable you to write free-form SQL for data access, including parameters. The results are seen as a table by Crystal Reports.

  • List of values Dynamic or scheduled list of available parameter values.

    Caution

    One component not included in the BusinessObjects Repository is report templates. Although it is possible to secure the template via BusinessObjects Enterprise security, it is not possible to automatically loop through all the reports that reapply a new template. This task is possible but it is a manual process or requires that an administrative script be written.


When publishing the relevant reports back to Enterprise XI, the report developer should check the Update Repository Objects box, as shown in Figure 17.3. This allows the system to check whether any repository components have changed and to make the necessary report changes. If this box is not checked, the report is skipped and nothing in the report is updated, even if the report object has been changed in the repository. The Publishing Wizard and the Central Management Console also provide the ability to set this flag.

Figure 17.3. Select the Enable Repository Refresh box to allow this report to check for modified shared report components.


If the organization wants to make changes at a later date to the notice or any other shared objects, the developer would open the report, disconnect the text object, make the change, and resave the object to the repository. All reports that use the text component and have the Repository Refresh flag confirmed will adopt the new component.

Adding Text Objects and Images

To add text and image objects to your report from the repository, the repository explorer should be open in Crystal Reports. To open the repository explorer, select Repository Explorer from the View menu at the top of your screen. You might need to authenticate with BusinessObjects Enterprise either by logging on as prompted by the logon screen or by clicking on the Logon icon at the top of the Explorer. After this occurs, you can see all the folders and objects available in the repository. To add a text or image field, simply drag the field onto the report. You will notice that the object is read-only. To modify the object, right-click the object and select Disconnect from Repository. You will then be able to modify the object. If the changed object is saved back into the repository with the same name, the original version is replaced and all Crystal Reports that use this object and remain connected are updated the next time they are viewed.

To reconnect a text object or image to the repository, simply drag and drop the object from the Design or Preview tab in Crystal Reports back to its original repository object name in the Repository Explorer. A dialog will appear to confirm that you want to update the original object or add a new one. The user can then set the properties of the object by adding the required information.

For information on how to set the security around the object explorer, p. 400.


Caution

The capability to store objects from Web and OLAP Intelligence reports in the repository was not supported at publication time.


SQL Commands

With the introduction of SQL Command objects to Crystal Reports, developers have been able to write custom database SQL to access data. The repository enables the developers to share these objects with others who might not have that skill set or those developers who do not want to reinvent the wheel.

To select a SQL Command from the repository, select the Repository from the Data Explorer or the Data step of the Report Wizard. Once again, BusinessObjects Enterprise will ask you to authenticate to ensure you are a valid user. Select the required SQL Command from the repository. If the command has any parameters associated with it, you will be required to populate the parameters. This enables the SQL statement to run, which will then populate the report with data, providing the report designer with some data to work with.

To add a new SQL Command object to the repository, use the Database Expert, connect to the database desired in the Available Data Sources list box, and choose Add Command from the list of available options. Select Add Command by double-clicking on it. This opens the Add Command to Report dialog. Then follow these steps:

1.

Enter the SQL statement you want into the query box. If parameters are required, you can use this dialog to create them as well by clicking the Create button in the Parameter List section. Click OK to close the Add Command to Report dialog.

2.

You are brought back to the Data tab of the Database Expert dialog. Before leaving this dialog, right-click the newly created SQL object under the selected tables pane and select the Add to Repository option.

3.

Complete the form by giving your SQL command object a name and then selecting a folder where you want to store the object.

If the user wishes to edit the SQL command object, she needs to first disconnect it from the repository, making the edit button accessible.

Custom Functions

Custom functions are reusable procedures that enable you to share logic across reports. To allow for this sharing, the function needs to be data- and report-independent and specific guidelines must be adhered to:

  • No User Function Libraries (UFL) can be used because these are machine dependent.

  • No report or data source fields.

  • You cannot associate a particular state with the function, such as Evaluation Time or Print State.

  • You cannot use recursion; that is, the function cannot call itself.

  • You cannot use variables, either shared or global, because these are report-specific.

    Caution

    Custom functions are not editable from the Repository Explorer because they are housed inside of Formulas. To view custom functions available in the Repository, go to Report, Formula Workshop. In the group tree, the Crystal Repository branch can be seen and all custom functions can be viewed from there.


Adding a new custom function to the repository needs to be done from within the Crystal Reports designer. The user can select the drop-down list from the new icon in the Formula Workshop. The function is then created and the user can select the Add to Repository icon, which adds the function to the desired location in the repository.

Organizing and Updating the Repository

The Repository Explorer represents the repository database as a tree structure made up of folders and objects. It is up to the report designer to decide how he wants to organize it. For example, the sample Repository that ships with BusinessObjects Enterprise XI is sorted by object types. The folders are named to indicate their contents (Images, Text Objects, and Commands). However, the content creator or report designer can use folders to his organizational advantage.

To add new folders to the repository, right-click on the desired folder where the intended subfolder is to be placed. If the folder is intended to be at the root, right-click on the repository name. Choose New Folder from the context menu.

To move objects or folders, drag and drop the object to the desired location. To rename a folder, simply choose the folder to be renamed, right-click on it, and choose Rename from the context menu.

After the shared object has been changed, there is an update process called the Object Repository Helper (found on the Administrator's Launchpad page under the Administrator's Tools section) that will loop through all the reports and update the changed component. An administrator can select all reports, individual reports, or all reports within a folder and its subfolders.




Crystal Reports XI(c) Official Guide
Crystal Reports XI Official Guide
ISBN: 0672329174
EAN: 2147483647
Year: N/A
Pages: 365

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net