Requirement: I have an Oracle APEX page displaying the Department’s data in tabular format. On the page, I have an item with the label as Department Name. Now, when we enter some value in the Department Name item and press the Enter Key of our keyboard, it should search and display the corresponding department details in the table.
Sample output screen is shown below:
Solution: For the solution of the above requirement, follow the steps as shown below:
Step 1: Create a blank page. Create a Region with the Title as Search
Step 2: Create an Item inside the Search Region. Set the properties for the Item as below:
- Name: P12_DEPARTMENT_NAME
- Type: Text Field
- Label: Department Name
Step 3: Create a Dynamic Action for the P12_DEPARTMENT_NAME item and set the below properties.
- Name: DepartmentNameDA
- Event: Key Down
- Type: Item is not null
- Item: P12_DEPARTMENT_NAME
Step 4: Set the properties of the True outcome as below
- Action: Execute JavaScript Code
- Code:
if(event.which == 13) { apex.submit('P12_DEPARTMENT_NAME'); }
Step 5: Create another Region and set the below properties:
- Title: Departments
- Type: Classic Report
- Location: Local Database
- Type: Table / View
- Table Name: DEPARTMENTS
- Where Clause:
DEPARTMENT_NAME like '%'||:P12_DEPARTMENT_NAME||'%' or :P12_DEPARTMENT_NAME IS NULL or :P12_DEPARTMENT_NAME =''
Click on Save and Run Page button. Thus, the ran page will look as below:
Enter Human in the Department Name field and press on the Enter Key of our Keyboard, and we can see the result table displaying only those record whose Department Name is having Human in it, say for example Department Name as Human Resource as shown below:
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
765 total views, 3 views today