Feed aggregator

Highlight numbers in an APEX Report (SQL and Class)

Dimitri Gielis Blog - Wed, 01/20/2016 - 15:31
Last year I blogged about highlighting negative numbers in an APEX Report, the CSS only way.
At that time I gave two alternative approaches; by using JQuery or SQL, but it looks like I didn't do those posts yet, till somebody reminded me. This post is about using SQL to highlight something in a report.

Let's say we want to highlight negative numbers in a report (as in the previous post):


We have some CSS defined inline in the Page:
.negative-number {
  color:red;
}

The negative-number class we will add to some values. All the logic to know if it's a negative number will be in SQL. Why SQL you might ask? This example is very simple, but you could call a function which has a lot of complexity to decide if you want to assign a class to a record or not, the principe of this example is more important, that you can use logic in SQL to work with CSS.
The SQL Query of the Report looks like this. Watch for the case statement where we say when to assign a value for the class:
select 
 description,
 amount,
 case 
   when amount < 0
   then 'negative-number'
   else ''
 end as class
from dimi_transaction
order by id

Finally we assign the class to the amount, by adding a span in the HTML Expression of the Amount column:

The Class column you can make Conditional = Never as it's something we just use behind the scenes.
That's how you make a bridge between SQL and CSS.
You can now play more with the case statement and even let the class or style e.g. color, come from a user defined table... unlimited possibilities :)

Indexes and Initrans (Blackstar)

Richard Foote's Blog - Thu, 01/14/2016 - 06:26
It’s been a very tough week so to help keep my mind off rather sad events, thought I’ll finish off one of my unpublished articles. Initrans is a physical attribute that determines the initial number of concurrent transaction entries allocated within each data block for a given table/index/cluster. Every transaction that updates a block has to acquire an […]

David Bowie 1947-2016. My Memories.

Richard Foote's Blog - Tue, 01/12/2016 - 02:06
In mid-April 1979, as a nerdy 13 year old, I sat in my bedroom in Sale, North England listening to the radio when a song called “Boys Keep Swinging” came on by an singer called David Bowie who I never heard of before. I instantly loved it and taped it next time it came on the radio via my […]

An Index or Disaster, You Choose (It’s The End Of The World As We Know It)

Richard Foote's Blog - Fri, 10/30/2015 - 04:42
This come up recently with a customer and I saw a related question on OTN that made me realize I haven’t previously discussed the SKIP_UNUSABLE_INDEXES parameter. Let me start by making a very simple point. All it potentially takes to make your entire database effectively inoperable or indeed to maybe bring down a RAC instance is […]

Richard Foote: Upcoming Presentation Events (David Live)

Richard Foote's Blog - Tue, 10/20/2015 - 00:28
I’ll be doing the rounds in Australia/NZ in the coming weeks so plenty of opportunity to catch-up and see me in action :) I’ll be doing a “National Tour” of my Let’s Talk Oracle Database sessions that I’ve been running locally in Canberra for a number of years. All events have limited places available so […]

Richard Foote: Upcoming Presentation Events (David Live)

Richard Foote's Blog - Tue, 10/20/2015 - 00:28
I’ll be doing the rounds in Australia/NZ in the coming weeks so plenty of opportunity to catch-up and see me in action :) I’ll be doing a “National Tour” of my Let’s Talk Oracle Database sessions that I’ve been running locally in Canberra for a number of years. All events have limited places available so […]

Opening of APEX R&D New Zealand

Dimitri Gielis Blog - Thu, 10/15/2015 - 07:20
We're really excited to announce that next to our Belgium office, we have opened an office in New Zealand too. This will allow us to cover multiple timezones and better serve the Australian and New Zealand market. You can read more about it on Lino's blog
 
Contact our team of experienced professionals for innovative, reliable and cost effective Oracle Application Express solutions. 
Regarding any custom application development, training/coaching or consulting related to Oracle APEX technology we would love to hear from you.
For more information please contact our Belgium or New Zealand office.
We look forward working with you.
Subscribe to Better Logic LLC aggregator