Skip Headers
Oracle® Fusion Middleware Oracle Reports User's Guide to Building Reports
11g Release 1 (11.1.1)

Part Number B32122-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

38.2 Create the Query and Paper Layout for a Multibyte Report

When you create a report, you can use either the Report Wizard to assist you or create the report manually.

To build the report in this example, you will use the Report Wizard. Using the wizard you will specify the layout, style, fields, and template details for the report. You will also provide the SQL query that contains the condition with a runtime user parameter. This parameter allows users to specify the language in which they want the report output printed.

To create a simple report:

  1. Launch Oracle Reports Builder (or, if already open, choose File > New > Report).

  2. In the Welcome or New Report dialog box, select Use the Report Wizard, then click OK.

  3. If the Welcome page displays, click Next.

  4. On the next page, make sure that Create both Web and Paper Layout is selected, then click Next.

  5. On the Style page:

    • Type a Title for your report, such as Product List.

    • Make sure that Tabular is selected.

    • Click Next.

  6. On the Data Source page, make sure that SQL Query is selected, then click Next.

  7. On the Data page, click Query Builder.

  8. In the Select Data Tables dialog box, click PRODUCT_DESCRIPTIONS, then click Include.

  9. Click Close.

  10. The table is displayed in the Query Builder. Click to the left of the following column names to select them:

    • PRODUCT_ID

    • LANGUAGE ID

    • TRANSLATED_NAME

    • TRANSLATED_DESCRIPTION

  11. Click OK.

  12. In the Data Source definition field, your query should look something like this:

    SELECT ALL PRODUCT_DESCRIPTIONS.PRODUCT_ID, 
    PRODUCT_DESCRIPTIONS.LANGUAGE_ID, 
    PRODUCT_DESCRIPTIONS.TRANSLATED_NAME, 
    PRODUCT_DESCRIPTIONS.TRANSLATED_DESCRIPTION
    FROM PRODUCT_DESCRIPTIONS
    

    Note:

    You can enter this query in any of the following ways:

    • Copy and paste the code from the provided text file called utf8_code.txt into the Data Source definition field.

    • Click Query Builder to build the query without entering any code manually, as described in the steps above.

    • Type the code in the Data Source definition field.

  13. In the Data Source definition field, type where language_id = :p_lang_id, after the FROM clause in the query. This adds the where clause to the query definition The where clause restricts data based on the language selected by the user at runtime.

    Your query should now look like this:

    SELECT ALL PRODUCT_DESCRIPTIONS.PRODUCT_ID, 
    PRODUCT_DESCRIPTIONS.LANGUAGE_ID, 
    PRODUCT_DESCRIPTIONS.TRANSLATED_NAME, 
    PRODUCT_DESCRIPTIONS.TRANSLATED_DESCRIPTION
    FROM PRODUCT_DESCRIPTIONS
    where language_id = :p_lang_id
    

    Note:

    The expression, :p_lang_id, when prefixed with a colon is treated as a parameter. If the parameter does not exist, Oracle Reports Builder creates the parameter. From here on, you can access this parameter in the User Parameters section under the Data Model node in the Object Navigator.

  14. Click Next.

    Oracle Reports Builder displays the following message to indicate that an additional parameter is created:

    Note: The query 'Q_1' has created the bind parameter(s) 'P_LANG_ID'.
    
  15. Click OK.

  16. On the Fields page:

    • Click PRODUCT_ID in the Available Fields list, and click the right arrow (>) to move the field to the Displayed Fields list.

    • Click TRANSLATED_NAME and click the right arrow (>) to move the field to the Displayed Fields list.

    • Click TRANSLATED_DESCRIPTION and then click the right arrow (>) to move the field to the Displayed Fields list.

  17. Click Next.

  18. On the Totals page, click Next.

  19. Click Next on the Labels page.

  20. On the Templates page, make sure that Beige is selected and click Finish.

    Oracle Reports Builder displays the Runtime Parameter Form because you referenced a user parameter.

  21. Type JA, and click the Run Report button to execute the report.

    The report output is displayed in Paper Design view. It should look something like this:

    Figure 38-4 Paper design view of the report without Japanese characters in default setting

    Description of Figure 38-4 follows
    Description of "Figure 38-4 Paper design view of the report without Japanese characters in default setting"

    Tip:

    If you do not see any results, make sure that the value JA is typed in capital letters so that data is retrieved from the database for the specified condition.

    You will not see any Japanese characters yet since a UTF8 TrueType font has not been selected.

  22. Save the report as multibyteutf8_your_initials.rdf.

    Note:

    When designing a report, it is good practice to save it frequently under a different file name as a precautionary measure. Then, if you need to revisit some of the changes or if you generate an error, you can go back to the previously saved file and make revisions from that point.