Formatting Negative Amounts in Interactive Reports : A Simple Guide

When working with interactive reports in Oracle APEX, one common requirement is to format negative amounts in a way that’s easy to understand. For instance, instead of showing a negative number like $-200
, you may want to display it as ($-200)
and change the text color to red for better visibility.
Luckily, accomplishing this formatting in an Interactive Report is straightforward. In this blog, we’ll go over an easy method to achieve this result without too much hassle.
Step 1: Add a Virtual Column for Conditional Color Formatting
First, you’ll need to create a virtual column that will help determine when to apply the red color formatting to negative values.
Here’s the SQL for the virtual column:
CASE WHEN SAL < 0 THEN 'red' ELSE NULL END AS RED_COLOR
Step 2: Add a Format Mask to the Amount Column
Instead of manually building strings with TO_CHAR()
and ABS()
, use APEX’s built-in format mask on the numeric column.
Apply the following format mask to the Number Column (e.g., SAL
or AMOUNT
):
FML999G999G999G999G990D00PT
Step 3: Add an HTML Expression to Show Formatted Value in Red Color
Now, we’ll use an HTML Expression to display the amount in red if it's negative. In your Interactive Report, you can directly reference the RED_COLOR
virtual column and apply inline HTML.
For example: <span style="color:#RED_COLOR#">#SAL#</span>
Result:
Here’s a screenshot showing the final outcome of the formatted amounts in red color. Negative values are displayed as ($200.00)
for easy identification.
Conclusion
With these simple steps, you can format negative numbers in Oracle APEX Interactive Reports and make them easy to spot. The combination of virtual columns, format masks, and HTML expressions gives you the flexibility to present data in a visually clear and appealing way.
Would you like to refine any part of the blog or add other enhancements? Feel free to share more details!
Subscribe to my newsletter
Read articles from Vaibhav Gajare directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Vaibhav Gajare
Vaibhav Gajare
Oracle APEX Developer cloud developer certificate professional