Home > Building Your Application > Adding a Conditional Depart... > Creating the Report and Con...
Previous |
Next |
First, create the report and set it to conditionally display.
To create the report and condition:
Navigate to the Page Definition for page 3, Employees.
Under Regions, click the Create icon.
For Region:
Identify the type of region to add to this page - Select Report and click Next.
Report Implementation - Accept the default, SQL Report, and click Next.
For Display Attributes:
Title - Enter Department Details
.
Region Template - Select No Template.
Sequence - Enter 7
.
Accept the remaining defaults and click Next.
For Source:
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
Click Next.
Next, you create a condition that does not display department details when the user selects the No Department Assigned option.
For Report Attributes:
Report Template - Select default: vertical report, look 1 (include null columns).
This selection displays the list vertically.
Accept the remaining defaults and click Next.
For Conditional Display:
Condition Type - Select Value of Item in Expression 1 != Expression 2.
Note the exclamation point (!) included after Expression 1 in the option to select.
Expression 1 - Enter:
P3_DEPARTMENT_ID
Expression 2 - Enter:
-1
Click Create Region.