Using Business Views with Crystal Reports


Using Business Views with Crystal Reports

Once you ve created your Business Views, you will probably want to test them in Crystal Reports itself (or, perhaps you are not charged with actually creating Business Views, but just need to use them in report design). Basing a report on a Business View is essentially the same as basing it on a regular database or SQL Command.

When you initially create a new report, you ll find Business Views in the Repository category of the Database Expert. When you click the plus sign next to the category, you ll be prompted to log on to Crystal Enterprise. Provide valid logon credentials to connect to the repository. The Crystal Enterprise Explorer dialog will appear showing the repository folder structure. Click plus signs next to folders to look for any Business Views (you ll also see SQL Commands inside folders). Once you ve found the desired Business View, double-click it or select it and click Open .

click to expand

The Database Expert will show the Business View in the Available Data Source box on the left side. Clicking the plus sign next to it will reveal the Business Elements or tables included in the Business View. As with other database choices, select one or more of the Business Elements and add them to the Selected Tables list on the right. When finished adding Business View tables, click OK to close the Database Expert.

click to expand
Note  

Even though you will see the individual tables in the Links tab in the Database Expert after adding multiple Business View tables, you won t be able to actually link the tables together. Linking is handled automatically within the Business View.

When the Field Explorer is displayed, you ll notice that the Business View tables you chose will appear just like a regular database table. Clicking plus signs next to the tables will reveal the fields from within the Business View. Drag and drop them to the report just like regular database fields.

click to expand

Even though the Business View may already apply filters or row security, you may still create your own record selection using the Select Expert, just as you would with a regular database connection. Most other report design capabilities also exist with Business Views, such as formatting and formula creation (you may not be able to create SQL Expressions, however).

Caution  

Crystal Reports 10 introduces two important Business View limitations that you should be aware of. First, you cannot mix any other datasources in a report that s based on a Business View. Attempting to add any additional datasources to a Business View-based report will result in an error message. Second, once you base a report on a Business View, you can t change the report to be based on a non-Business View datasource with the Set Datasource Location option. You ll only be able to change the report to work with a different Business View.

Row and Column Security

One of the benefits of using Business Views with Crystal Reports is row and column security. Row security will limit your reports to only the database records applicable to you. For example, when viewing a sales report, the Western Region Sales Manager can be limited to only seeing orders in the Northwest and Southwest. When viewing the same sales report, the National Sales Manager can view orders in all regions . The beauty of row security is that two different reports with two different sets of record selection aren t required to accomplish this. Row security applies the extra filters at run time to all reports based on the Business View supplying the row security. So, you can design a single report that will return different sets of records automatically based on the Crystal Enterprise user ID.

If row security is assigned to the Business View you ve based your report on, you may see different records than another user. For example, the exact same report based on the sample XTREME Business View discussed earlier in the chapter will return a complete set of regional customers to the National Sales Manager:

click to expand

while returning only Northwest and Southwest customers to the Western Region Sales Manager.

click to expand

Column security allows data from certain fields within a Business View to be hidden to certain Crystal Enterprise users. For example, when viewing an employee roster report, the HR Manager will be able to see data in the Annual Salary and Monthly Salary fields, along with other employee fields. When any other user views the same employee roster report, the Annual Salary and Monthly Salary fields will display null values, while other employee fields will still display the proper contents. The one issue with column security to be aware of is that, even if you aren t granted the rights to see fields, you ll still be able to drag them onto your report. When you preview the reports, however, you ll see nothing in them.

For example, the exact same report based on the sample XTREME Business View discussed earlier in the chapter will display salary data for employees when viewed by the HR Manager:

click to expand

while showing null values for the fields when viewed by any other user.

click to expand
Tip  

One new Crystal Reports 10 feature you may find handy is the CE User Name special field. This will print the Crystal Enterprise user name on the report. Choose it from the Special Fields category of the Field Explorer.

Disconnecting View Security

You may encounter a potential problem if you wish to send a Crystal report developed against a Business View to a Crystal Reports user who is not connected to the same Crystal Enterprise system, or who doesn t have Crystal Enterprise in their organization at all. This issue is compounded when row and column security are involved with the report, as there will be no CE user ID to base security on when the report is opened by the other user.

The solution to this problem is to disconnect view security from the report when saving it. First, ensure that the File Save Data With Report option is turned on. Otherwise, the non-CE report viewer won t be able to see anything but the report s Design tab. Then, choose File Save As and specify a new filename for the report. Notice the Disconnect View Security check box at the bottom of the dialog box.

click to expand

When the report is saved, it will be disconnected from the Business View. The report can be opened and viewed, but no longer refreshed. Also, you cannot reconnect a report to a Business View that has been disconnected in this manner.

Caution  

Be aware that if you have row and column security settings that permit you to see sensitive data, such as salaries, the sensitive data will be saved with the report when you disconnect view security. Other report viewers will see this data when they open the report, even though they won t be able to refresh the report.




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

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