Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Oracle APEX Cookbook : Second Edition
  • Table Of Contents Toc
Oracle APEX Cookbook : Second Edition

Oracle APEX Cookbook : Second Edition

4.6 (7)
close
close
Oracle APEX Cookbook : Second Edition

Oracle APEX Cookbook : Second Edition

4.6 (7)

Overview of this book

Table of Contents (21 chapters)
close
close
Oracle APEX Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1
Index

Including different item types


In APEX, it is possible to use many different item types. Some of these we've already seen in other recipes. In this recipe we're going to talk about some of the advanced item types such as shuttles and HTML editors and how to interact with them.

Getting ready

To start with this recipe, create an empty page with ID 15 and put an HTML region with the name IT Employees on it.

How to do it...

The first example of an advanced item type is the shuttle list. We will use this list to add employees to the IT department. The shuttle will show a list of available employees on the left-hand side and a list of employees already in the IT department on the right-hand side.

  1. Create a new item on your page by right-clicking on the IT Employees region and selecting Create Page Item.

  2. Select Shuttle and click on Next.

  3. Name the item P15_IT_SHUTTLE and click on Next until you reach the List of Values page in the wizard.

  4. Enter the following query to populate the left side of the shuttle:

    select username display_value
         , id return_value
      from app_employees
     where dept_id <> 3
    [9672_01_07.txt]
  5. After clicking on Next, you will be asked to enter a value for Source Value. This will populate the right-hand side of the shuttle. For this, we will use PL/SQL Function Body as the Source Type that will return a list of usernames delimited by colons:

    declare
      v_list apex_application_global.vc_arr2;
    begin
    
      select username return_value
        bulk collect
        into v_list
        from app_employees
       where dept_id = 3;
    
      return(apex_util.table_to_string(v_list));
    end;
    [9672_01_08.txt]
  6. Click on Create Item to finish the wizard.

Now the item will be populated with the employees:

The right-hand side of the shuttle item can also be populated by the default value that can be defined on the item's properties.

Another type of item we want to discuss here is the Cascading Select Item. Let's say we want to make a list of all employees. This is potentially a very long list, so before showing the employees, we first want to select the department we are working with.

First, we create the item that shows all departments for our company:

  1. Create a new page item.

  2. Use item type Select List.

  3. Name it P15_DEPARTMENTS.

  4. Give it a label and click on Next until you reach the LOV query, and enter the following SQL:

    select name display_value
         , id return_value
      from app_departments
    [9672_01_09.txt]
  5. Now create the item.

The next part is to create the select list for the employees in the department. Again, we create a select list like before and name it P15_EMPLOYEES.

Now when we reach the LOV wizard screen, we enter the following SQL:

select firstname||' '||lastname display_value
     , id return_value
  from app_employees
 where dept_id = :P15_DEPARTMENTS
[9672_01_10.txt]

Also on this screen, change the value of Cascading LOV Parent Item(s) to P15_DEPARTMENTS. Click on Next and then on Create Item.

When we now run the page and select a Department, we can see that the Employees list changes immediately.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Oracle APEX Cookbook : Second Edition
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon