Once you ve added objects to the repository as outlined earlier in the chapter, you, along with other users sharing the same repository, will want to add the items to reports. Repository versions of text objects, bitmap graphics, custom functions, SQL commands, and Business Views are added in different places throughout Crystal Reports.
Add these items to your report from the Repository Explorer (which can be displayed by clicking the Repository Explorer button in the Standard toolbar or with the View Repository Explorer pull-down menu item). If necessary, log on to Crystal Enterprise. Then, simply expand any folders to reveal the text objects and bitmaps that are available. If you want to see properties for a repository object, right-click the object and choose Properties from the pop-up menu. A small dialog box will appear showing various pieces of information about the object.
To add the object to the report, simply drag it from the Repository Explorer to the report. As when dragging and dropping fields from the Field Explorer, an outline will appear as you drag. When you ve reached the desired position for the object, release your mouse button. The text object or bitmap graphic will be placed on the report.
Tip | Don t be alarmed when you are unable to format or resize objects you add to the report from the repository. These objects are connected to the repository and can t be edited, resized, or formatted until they have been disconnected. This is discussed later in the chapter. |
Make use of repository custom functions in the Formula Workshop. You may add a custom function to the report from the repository directly, which will place it in the Formula Editor s function tree for use like built-in Crystal Reports functions. Alternatively, you can use the Formula Expert to create a formula based on a custom function from the repository.
To add a custom function to the report directly, so that it appears in the Formula Editor s function tree, begin by displaying the Formula Workshop. You may do this by clicking the Formula Workshop button in the Expert Tools toolbar, or by choosing Report Formula Workshop from the pull-down menus .
Expand the Repository Custom Functions category of the Formula Workshop until you find the custom function that you wish to use (you may need to log on to Crystal Enterprise if you haven t previously). Select the function you wish to add and click the Add to Report toolbar button in the Formula Workshop toolbar. You can also right-click the function name in the Formula Workshop tree and choose Add to Report from the pop-up menu. And finally, you may simply drag the custom function you wish to add to the report from the Repository Custom Functions category to the Report Custom Functions category of the Formula Workshop tree.
Since a repository custom function can potentially call other custom functions within the repository, you may be asked to confirm the addition to the report of other custom functions. Once you do this, all custom functions you ve added from the repository will now appear in the Custom Functions category of the function tree for you to add to formulas.
Tip | More details on creating formulas with the Formula Expert and using custom functions in formulas can be found in Chapters 5 and 6. |
Add repository-based SQL commands and Business Views to your report from the Database Explorer, the Set Location dialog box, or another data- related dialog box that you typically use to add database tables to the report. In these dialog boxes, you ll see a Repository folder that you can expand to see the folder structure that has been set up in the repository. If prompted, log on to Crystal Enterprise. Then, expand the folders to reveal SQL commands or Business Views that are located in the repository. An example of the Database Expert is shown here:
Choose the SQL command or Business View that you want to add to the repository. You may then click the right arrow to add the selected repository SQL command to the report, right-click the command and choose Add to Report from the pop-up menu, or just drag the command or Business View from the left side of the Database Expert to the right side. Similar procedures will add SQL commands and Business Views to the report from the repository in other data-related dialog boxes.