If the database you are using supports SQL, you can write your own command, which will be represented in Crystal Reports as a Table object. This allows users complete control of the data processing that gets pushed down to the database server.
You can write your own command by using the SQL scrapbook page feature provided by the Eclipse Web development environment. To learn more about the SQL Scrapbook, see to the Eclipse documentation provided in the Web Application Development User Guide.
Adding the SQL command to your report will create a virtual table that will represent the results of processing the command.
The SQL scrapbook page is added to the project you selected and opens in the SQL editor.
For example:
SELECT
Customer.`Customer ID`,
Customer.`Customer Name`,
Customer.`Last Year's Sales`,
Customer.`Region`,
Customer.`Country`,
Orders.`Order Amount`,
Orders.`Customer ID`,
Orders.`Order Date`
FROM
Customer Customer INNER JOIN Orders Orders ON
Customer.`Customer ID` = Orders.`Customer ID`
WHERE
(Customer.`Country` = 'USA' OR
Customer.`Country` = 'Canada') AND
Customer.`Last Year's Sales` < 10000.
ORDER BY
Customer.`Country` ASC,
Customer.`Region` ASC
Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
Note: To do this, you must be connected to a database.
In the Data Output window, the status will be displayed as either “success” or “failure”.
In your report, a Command table appears, listing the database fields you specified.
Note: Editing Crystal SQL Command objects in your report is not supported. To change a Crystal SQL Command object in your report, delete it from your report and create a new command object.
| Business Objects http://www.businessobjects.com/ Support services http://www.businessobjects.com/services/support/ |