Introduction
Oracle APEX provides powerful customization options through Item and Column properties that allow developers to control the behavior, appearance, and validation of form fields and report columns. By mastering these properties, you can build applications that are both intuitive for users and robust in logic. Whether you're working on a simple form or a complex interactive report, understanding how to create and apply APEX item and column properties is essential for fine-tuned user interface control.
How do I Create APEX Item and Column Properties
In Oracle APEX, items refer to form controls like text fields, select lists, checkboxes, etc., while columns refer to data fields displayed in reports such as Classic Reports, Interactive Reports, and Interactive Grids. You can configure properties for both types via the Page Designer.
-
Creating Items (Form Controls)
-
Navigate to your page in Page Designer
-
Under the Rendering pane, right-click the region where you want to add the item
-
Click Create → Item
-
Choose an item type (e.g., Text Field, Select List, Hidden, etc.)
Common Item Properties (set in the Property Editor):
-
Name: Must be unique on the page (e.g.,
P1_USERNAME
) -
Label: Displayed to users next to the item
-
Type: Determines input method
-
Default Value: Set a static or dynamic default
-
Source: Bind to a DB column or use a computation
-
Validation: Add SQL or PL/SQL logic to ensure user input is valid
-
Read-Only / Required: Enforce business logic or workflow restrictions
-
Appearance: Control CSS classes, alignment, width, and templates
-
Dynamic Actions: Use to trigger actions when the item changes
-
-
Creating Column Properties in Reports
-
Navigate to a Classic Report, Interactive Report, or Interactive Grid
-
Under the Rendering pane, click on your report region
-
Under Columns, select or create a column
Key Column Properties:
-
Column Name: Comes from your SQL query alias
-
Heading: What the user sees as the column title
-
Type: Display as plain text, link, icon, or progress bar
-
Formatting: Apply masks for dates, currency, or custom number formats
-
Display As: Set input types for editable columns (Interactive Grid)
-
Read-Only Condition: Disable edits conditionally
-
Link: Create navigation actions using column values
-
Column CSS Classes: Add custom styles for alignment, color, etc.
-
-
Advanced Techniques
-
Use Substitution Strings in headings or help text (e.g.,
&P1_USER.
) -
Combine Dynamic Actions with item value changes for real-time UI updates
-
Add PL/SQL or JavaScript to customize item behavior further
-
Use declarative Conditions to show/hide or disable items based on logic
-
In Interactive Grids, mark columns as editable and use Save Process to persist data
-
-
Tips
-
Use meaningful item names and column aliases to simplify maintenance
-
Group items using region templates or collapsible panels for better UX
-
Always test validations and dynamic actions thoroughly across use cases
-
Use Shared Components → Lists of Values to drive Select Lists and Popup LOVs
-
In Oracle APEX, you can customize how form items and report columns are displayed by using various properties. These properties allow you to modify labels, display values, disable/enable items, manage CSS classes, and determine required fields, among other things.
In this tutorial, we will walk you through how to use the Item Properties and Column Properties in Oracle APEX with practical examples. We'll cover the following properties:
Item Properties:
LABEL
DISPLAY
CHANGED
DISABLED
Column Properties:
HEADING
LABEL
DISPLAY
HEADING_CLASS
COLUMN_CLASS
REQUIRED
Step 1: Understanding Item Properties
When working with form items (such as text fields, drop-down lists, checkboxes, etc.) in APEX, you have several important properties that control their behavior and appearance. Below, we will explain how to use these properties in your application.
1. Item Property: LABEL
Purpose: The LABEL property defines the text label that appears next to a form item (such as a text field or drop-down). This is typically used to explain what the input is for.
Usage: You can set this property when configuring a form item.
Example:
Create an item like Text Field for First Name.
In the Label field, enter "First Name". This will show up next to the input field on the form.
2. Item Property: DISPLAY
Purpose: The DISPLAY property defines the current value that is shown in the form item when the page is rendered.
Usage: This property can be set dynamically using SQL queries or PL/SQL.
Example:
Create a Text Field for First Name.
Set its Value property to SELECT first_name FROM employees WHERE employee_id = :P1_EMPLOYEE_ID.
When the page loads, the first name of the employee with P1_EMPLOYEE_ID will be displayed in the text field.
3. Item Property: CHANGED
Purpose: The CHANGED property indicates whether the value of an item has been modified. It will return "Y" if the value has changed from its default value and "N" if it hasn’t been changed.
Usage: This is useful for validation or to trigger certain actions when a field is edited.
Example:
Create a Text Field for Email Address.
Add the following Dynamic Action:
Event: Change
Action: Display a message if the Email Address has changed.
Condition: CHANGED = "Y"
4. Item Property: DISABLED
Purpose: The DISABLED property controls whether the form item is editable. If set to "Y", the item will be disabled, preventing the user from modifying its value.
Usage: This can be used in scenarios where certain form items should not be modified by the user.
Example:
Create a Text Field for Employee ID.
Set the Disabled property to "Y" for Employee ID, making it non-editable. The value will still be visible, but the user cannot modify it.
Step 2: Understanding Column Properties
When dealing with reports, you can customize the appearance and behavior of columns by setting various column properties. These properties help define the label, heading, required fields, and other visual elements for the columns in your report.
1. Column Property: HEADING
Purpose: The HEADING property defines the column heading text that appears at the top of each column in a report.
Usage: You can set this property to a custom string or use it to include HTML tags or other formatting.
Example:
For a Classic Report, the column First Name can have the heading Employee First Name.
In the Column Attributes section, set the Heading to: <b>Employee First Name</b> (using HTML tags for bold text).
2. Column Property: LABEL
Purpose: The LABEL property defines the text label for each column. If no specific label is set, the column HEADING is used.
Usage: This is often used when you want to provide a different label from the heading for columns.
Example:
For the First Name column in a report, you can set the Label to "Name". The Heading would still be "Employee First Name", but the column would display as "Name" in the report.
3. Column Property: DISPLAY
Purpose: The DISPLAY property controls how the value for a column is displayed in the report.
Usage: This property can be customized using SQL expressions, PL/SQL, or APEX substitution variables to format the data as per the requirements.
Example:
For a Salary column in a report, you can format the display value to show the salary in a specific format (e.g., including currency symbol).
TO_CHAR(salary, '999,999.99')
4. Column Property: HEADING_CLASS
Purpose: The HEADING_CLASS property allows you to add custom CSS classes to the column heading.
Usage: This property is useful when you want to style the column headings with specific CSS rules.
Example:
In the Column Attributes, you can add a CSS class to the HEADING_CLASS property like class="heading-blue".
In the CSS file, define:
.heading-blue {
color: blue;
font-weight: bold;
}
5. Column Property: COLUMN_CLASS
Purpose: The COLUMN_CLASS property lets you add CSS classes to the column cells in a report.
Usage: This property is useful when you want to style the data in a particular column based on certain conditions.
Example:
For the Salary column, you can set the COLUMN_CLASS property to class="salary-column".
Then, in your CSS file, you can define a specific style:
.salary-column {
font-weight: bold;
color: green;
}
6. Column Property: REQUIRED
Purpose: The REQUIRED property determines whether a column in a form is mandatory for users to fill out before submitting the form.
Usage: This property is particularly useful for form items in APEX. If set to "Y", the column is marked as required.
Example:
For a Text Field for Employee ID, set the Required property to "Y" to make it a mandatory field.
The form will display a red asterisk next to the input field to indicate that it’s required.
Step 3: Practical Example – Using Item and Column Properties
Let's combine the item and column properties in a practical example, where we create a form and a report that display dynamic data.
Create a Form Page:
Go to App Builder, and create a new Form page.
Add a Text Field for Employee ID:
Label: "Employee ID"
Display: A SQL query to fetch the employee’s ID based on a session value.
Disabled: "Y" (making it non-editable)
Add a Text Field for Employee Name:
Label: "Employee Name"
Required: "Y" (making it mandatory)
Add a Select List for Job Title:
Label: "Job Title"
Display: A dynamic list query to display job titles.
Required: "Y"
Create a Report Page:
Add a Classic Report to the page.
Set the SQL Query to retrieve employee information:
SELECT employee_id, first_name || ' ' || last_name AS employee_name, job_title, salary
FROM employees
Configure the column properties:
Heading: "Employee Information"
Label: "Full Name"
Column Class: class="employee-column"
Required: "N" (not applicable for reports)
Customize the Salary column:
Heading: "Annual Salary"
Display: Format the salary column as currency using TO_CHAR(salary, '999,999.99').
Styling:
Add custom CSS for the report and form:
.employee-column {
font-size: 14px;
font-weight: bold;
}
Conclusion
Creating and configuring APEX Item and Column properties gives you precise control over your application's user interface and logic. By combining declarative settings with dynamic behaviors, you can deliver data-driven pages that are functional, responsive, and intuitive. Mastering these properties is a key step in becoming proficient in Oracle APEX development, allowing you to tailor every page to meet user and business requirements effectively.
No comments:
Post a Comment