Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Understanding Badges in APEX 5

Scott WesleyAug 24 2015 — edited Aug 24 2015

I've just been playing around with Badges in APEX 5 and I was wondering if I could get a better idea of how they could/should be used.

For reference, this image is from apex.oracle.com/ut

badges.png

There is a Badge template for reports where a query might look like

select count(*) started

,count(completed) completed

from my_table

and it will render a badge for every column returned, using the column alias as the label. This can make for an efficient query.

But it took me a while to work at that's what the badges would, I can't find help text on this like we've seen with help on chart sql - does anyone know where to find this?

There is also a badge template for lists, which means we can link to targets under each badge, and each badge has a higher contrasting blue as hover.

But if I want to use the same type of SQL instead of a bunch of union statements repeating similar queries, I would need to maybe do an unpivot?

select null lvl

,descr

,null target

,null curr

,null i1,null i2,null i3

,result a1

from (

select count(*) result1, 'Started' descr1

,count(completed) result2, 'Completed' descr2

from my_table

)

unpivot

((result, descr)

for value\_type in (

  (result1, descr1) as 'Started'

 ,(result2, descr2) as 'Completed'

)

)

Just before I posted I realise this could be simplified slightly to

select ...

from (

select count(*) result1

,count(completed) result2

from my_table

)

unpivot

(result

for descr in (

  (result1) as 'Started'

 ,(result2) as 'Completed'

)

)

But I suspect it would still run faster than

select 1 lvl, 'Started', null target, null curr,null i1,null i2,null i3,count(*) a1

from my_table

union all

select 1 lvl, 'Completed', null target, null,null,null,null,count(completed)

from my_table

And then there is the badges plugin found the sample application, which takes SQL similar to basic chart format, but linking to only one target. And I'm not sure what the percent column is used for.

select 'Open' as label,

   to\_char(320,'9G990') as value,

   13                   as percent

from dual

select

count(\*) c,

'Views' l,

1 disp

from

eba\_sales\_clicks

Is anyone aware of further information on badges, or have anything to add?

We have three distinctly different ways to produce the same thing, which can be handy but it's a guessing game to work through.

Scott

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2015
Added on Aug 24 2015
0 comments
2,364 views