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!

Badge Color Coding

JasonSAFeb 7 2019 — edited Feb 26 2019

Hello,

I have a question regarding the color coding of badges.  We are currently running APEX version 5.1.2.  I would like to make reference to the following thread between Keegan Walker (who I work with) and Pierre Yotti:

https://community.oracle.com/thread/4134119 

I understand the concepts outlined in this post, however, it doesn’t completely meet the needs of the report I’m doing.  In Keegan’s example, she wants to color code based on the count of the badge.  She is making reference to that count in her javascript this way (highlighted in yellow):

    if (parseInt($(this).text()) >= 1 && parseInt($(this).text()) < 3)

    {

      $(this).css({

"background-color": "orange"

      });

      $(this).css({

"box-shadow": "0 0 0 1px #ed813e inset"

      });

$(this).find("a").find("a").css({

        "color": "yellow"

      });

    }

I have the same kind of badges as Keegan, but my count is an overall count of both “Widgets that are coming due” and Widgets that are past due.  So one of my badges could have a count of 750, 600 of which might be coming due, while 150 are past due.  If the count in the badge has some overdue counts in it, I want to set the color red, if there are no past due counts (only coming due counts), I want to set the color to yellow.

Naturally I want to replace $(this).text() with a sql statement that would be something like this:

I (parseInt(select count(*) from table where pastdue = ‘Y’)) > 0 set badge to red.

I understand that isn’t possible in this context, but I wanted to get the idea across.  So, how would I go about achieving this? Originally I thought I could put a case statement in the SQL of my badge report and set the color there.  The same way I do with Interactive Reports, but that doesn’t seem to work.  If I’m not being clear enough or if you need more info, please let me know.

Thanks,

Jason

Comments
Post Details
Added on Feb 7 2019
23 comments
5,694 views