Previous
Previous
 
Next
Next

Creating the Report and Condition

First, create the report and set it to conditionally display.

To create the report and condition:

  1. Navigate to the Page Definition for page 3, Employees.

  2. Under Regions, click the Create icon.

  3. For Region:

    1. Identify the type of region to add to this page - Select Report and click Next.

    2. Report Implementation - Accept the default, SQL Report, and click Next.

  4. For Display Attributes:

    1. Title - Enter Department Details.

    2. Region Template - Select No Template.

    3. Sequence - Enter 7.

    4. Accept the remaining defaults and click Next.

  5. For Source:

    1. Enter the following query:

      SELECT count(e2.employee_id) "Number of Employees:",
          substr(e.first_name,1,1)||'. '|| e.last_name "Manager Name:", 
          c.country_name "Location:"
          FROM  oehr_departments d, oehr_employees e, 
              oehr_locations l, oehr_countries c, 
              oehr_employees e2
          WHERE d.manager_id    = e.employee_id 
          AND d.location_id   = l.location_id 
          AND d.department_id = e2.department_id
          AND l.country_id    = c.country_id 
          AND nvl(d.department_id,'-1') = nvl(:P3_DEPARTMENT_ID,'-1')
          GROUP BY substr(e.first_name,1,1)||'. '||e.last_name,  c.country_name
      
    2. Click Next.

    Next, you create a condition that does not display department details when the user selects the No Department Assigned option.

  6. For Report Attributes:

    1. Report Template - Select default: vertical report, look 1 (include null columns).

      This selection displays the list vertically.

    2. Accept the remaining defaults and click Next.

  7. For Conditional Display:

    1. Condition Type - Select Value of Item in Expression 1 != Expression 2.

      Note the exclamation point (!) included after Expression 1 in the option to select.

    2. Expression 1 - Enter:

      P3_DEPARTMENT_ID
      
    3. Expression 2 - Enter:

      -1

    4. Click Create Region.