Regardless of the type of Repository Object, from time to time, objects will likely need to be updated. For example, the company address text object would need to be updated if the company moves to a new location. To successfully update any repository object, two fundamental steps must be taken:
Disconnecting a Repository ObjectBecause the Repository is basically a library to store objects, it has no update functionality in itself. This means that updates to objects must be done directly inside a Crystal Report. All connected repository objects are automatically considered read-only and cannot be changed. To update a specific object, you first need to disconnect it from the repository. This can be done by right-clicking on the object and choosing Disconnect Repository Object in the Design or Preview tabs.
After the object is disconnected, the needed changes can be applied to the object. However, the changes do not become global to the repository and all other reports using the object until the object is connected back to the repository. Reconnecting an Updated Object to the RepositoryNow that the object has been updated as desired, only the report where the update has occurred is currently changed. This is because the repository has not been made aware of the change. To make the repository aware, the object must be reconnected to the repository. To reconnect a text object or image to the repository, simply drag and drop the object from the Design/Preview environment back to its original repository object name/location in the Repository Explorer. A dialog will appear to confirm if you want to update the original object or add a new one. Because Update is already chosen, clicking OK will update the object. For example, if a logo has been changed and the original object was called corporate logo, drag the new logo image directly over the name corporate logo in the Repository Explorer. When prompted to update or add, confirm it as an update and click OK. The corporate logo for this report will now be reconnected, and the repository will be updated for all other reports as well. To reconnect a Custom Function in the Formula Editor, simply right-click on the disconnected and updated custom function's name in the workshop tree and choose Add to Repository. There will be a prompt for which specific repository you want to update. But because there is only one in this case, clicking OK will reconnect the object and update the repository in one step.
To reconnect a SQL Command to the repository, the Add to Repository toggle in the Modify Command dialog (where the changes to the command have been made) will need to be selected. Once the OK button is clicked, the updated command will be reconnected to the repository. This can be done from either the Database Expert dialog or the Data tab in the Report Expert.
Sharing a Repository with OthersThe focus of this lesson has been on sharing objects, formatting and logic between reports. This focus has been for one report designer to increase his productivity. However, the idea of a report object repository raises the question, "Can this sharing of information be shared between multiple report designers?" The answer to this question is yes. By creating the repository as a database, the idea was two-fold to share knowledge between reports as well as to share that same knowledge with other report designers. However, the underlying database type is the key. Crystal Reports needed to provide the sample Crystal Repository in a small compact database, so Microsoft Access was chosen as the default source. However, this database is not conducive to sharing among many users. Fortunately, the fact that an open data access method (ODBC) is used as a middle tier (or middleman) means that other relational databases could be used as well. For example, if a report designer has access to Microsoft's SQL Server database, he could publish his repository to this database source (by importing his existing MDB) and give access to the repository to other colleagues. By sharing one repository, all the report designers would more likely be consistent across their reports and more productive with their design efforts. To inform the Crystal Reports application about the change to the location of the data source, the report designer will have to create an ODBC data source for his new database.
After the data source is created, edit the ORMap.INI located in c:\program files\common files\crystal decisions\2.0\bin. Change the name after the = sign at the end of the file to be the exact data source name that has recently been created. Run Crystal Reports and open the Repository Explorer. Notice that the database has changed to the new data source.
|