This discussion is archived
1 2 3 Previous Next 30 Replies Latest reply: Jul 13, 2011 5:50 AM by 622257 RSS

Background Colour of Report Cell Issues.

622257 Newbie
Currently Being Moderated
I have done searching but so far no solution I can understand in my situation :) ...

I have a report where the values of a cell are coloured in based on some code values. It works great, except that Span Style will only of course 'span' the values that show up in the cell, not the whole cell...

Under Column Formatting I use the following HTML expression and it works. BUT, I want the WHOLE CELL to colour in ....

What am I missing here ? Obviously "span style" is not the correct tag .... I searched through different HTML sites too for some help but no luck with that I can figure out ....


spaan style= color:#COLOUR#;font-weight:bold;" #Buffer Usage# /spaan ( LOL It was hard to get the tag to actually show up in the posting, so forgive the wierd spelling of things !! )

Ideas ? Thanks !

Edited by: metropoj on Apr 13, 2011 2:50 PM

Edited by: metropoj on Apr 13, 2011 2:51 PM

Edited by: metropoj on Apr 13, 2011 2:51 PM

Edited by: metropoj on Apr 13, 2011 2:52 PM
  • 1. Re: Background Colour of Report Cell Issues.
    TexasApexDeveloper Guru
    Currently Being Moderated
    Do mean to have it look like this example: http://apex.oracle.com/pls/apex/f?p=50942:82:434958027002813??

    Then look at this page from Carl's example page: http://apex.oracle.com/pls/otn/f?p=11933:7:1274382349162513

    Thank you,

    Tony Miller
    Webster, TX

    What if you really were stalking a paranoid schizophrenic... Would they know?

    If this question is answered, please mark the thread as closed and assign points where earned..
  • 2. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    That's pretty close to what I'm looking for and I'll have to check into that further.

    That seems to color in the whole row instead of just the cell itself. I saw similar code to what was posted here ,

    http://stackoverflow.com/questions/3244909/how-can-i-change-the-background-color-of-a-cell-in-a-jqgrid-custom-formatter


    But in the end, not being a major programmer I had no idea where to stick similar code to get it to work ... :( ...
  • 3. Re: Background Colour of Report Cell Issues.
    fac586 Guru
    Currently Being Moderated
    spaan style= color:#COLOUR#;font-weight:bold;" #Buffer Usage# /spaan ( LOL It was hard to get the tag to actually show up in the posting, so forgive the wierd spelling of things !! )
    No, not reading the <a href="http://wikis.sun.com/display/Forums/Forums+FAQ#ForumsFAQ-Arethereanyusefulformattingoptionsnotshownonthesidebar%3F">FAQ</a> falls into the realm of the unforgivable: wrapping any code posted in <tt>\{code}...\{code}</tt> tags preserves formatting and special characters.

    Not searching the forum to find several years worth of discussion on this topic is also pretty heinous (as is Oracle's failure to do anything to meet this basic requirement). As noted above, use a custom report template or resort to Dynamic Actions/JavaScript.
  • 4. Re: Background Colour of Report Cell Issues.
    jwellsnh Expert
    Currently Being Moderated
    The example your link is referring to is an Interactive Report. Use Highlight on a report column to control Background Color and Text Color based on an Operator and Expression.

    Jeff
  • 5. Re: Background Colour of Report Cell Issues.
    jariola Guru
    Currently Being Moderated
    Hi,

    What is your Apex version?

    I have done one sample on Apex 3 using jQuery.
    http://actionet.homelinux.net/htmldb/f?p=100:201

    It is much easier with Apex 4 archive same.


    Regards,
    Jari
  • 6. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    We're not all experts like you fac586. If I was an expert i would help those out who are not experts instead of your heinous rant ... I will move on to more helpful suggestions

    Edited by: metropoj on Apr 14, 2011 8:02 AM
  • 7. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    Thanks Jarola, I will review and see what you have done. yes, i am in 3 still but we are planning to upgrade to 4 soon .....
  • 8. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    Hi Jarola, yes, that is exactly the result I am trying to achieve.

    I see your code function colorCell. That does seem like a lot to simply colour in a cell ! So Apex 4 will handle that better ?

    If I can figure it out, where would I place that code in my report? As mentioned above I placed my span code in the Column Attributes, HTML expression. This looks a lot more heavy duty !

    Thanks for the tips.

    Edited by: metropoj on Apr 14, 2011 7:57 AM
  • 9. Re: Background Colour of Report Cell Issues.
    jariola Guru
    Currently Being Moderated
    Hi,

    You need load jQuery in page HTML header or page template header.
    See e.g.
    http://www.oracleapplicationexpress.com/tutorials/66

    I did report query based in Tyler Muth blog post
    http://tylermuth.wordpress.com/2007/12/01/conditional-column-formatting-in-apex/
    SELECT e.*,
      CASE
        WHEN sal < 1000
        THEN 'red'
        WHEN sal BETWEEN 1000 AND 2000
        THEN 'yellow'
        WHEN sal > 2000
        THEN 'green'
      END the_color
    FROM emp e
    Then I did go edit "the_color" column attributes and set Display As to "Hidden".
    Report column template must have headers attribute.
    My Column Template 1 looks like this
    <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#">#COLUMN_VALUE#</td>
    Then if you do not allow partial refresh on report , just place to report region footer
    <script type="text/javascript">
    $(function(){
     $('##REGION_ID# input[name="f01"]').each(function(i){
      $(this).parents("tr:first").find('[headers="SAL"]').css({"background-color":$v(this)});
     });
    });
    </script>
    Regards,
    Jari
  • 10. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    Ahh, I get it now.

    OK, I had seen Tyler's work too and adopted some to do the shading but not the whole cell.

    OK, I'll digest this and try to adapt for my needs.

    Thanks Again for the direction to understand what to do !!!.... VERY helpful .....
  • 11. Re: Background Colour of Report Cell Issues.
    jariola Guru
    Currently Being Moderated
    Hi,

    As you also still run Apex 3, this might interest you
    http://dbswh.webhop.net/apex/f?p=BLOG:READ:0::::ARTICLE:347800346935688


    Regards,
    Jari
  • 12. Re: Background Colour of Report Cell Issues.
    622257 Newbie
    Currently Being Moderated
    Thx Jari... I am going to work through your example more today and I'm sure I'll have a few questions for you :) Thanks again for your knowledge / direction ....
  • 13. Re: Background Colour of Report Cell Issues.
    Little Foot Journeyer
    Currently Being Moderated
    hi,

    i am also doing the something similar but not able to color the cell.

    i simply used a sql statement in my report region:
    select      "EMP"."EMPNO" as "EMPNO",
          "EMP"."ENAME" as "ENAME",
          "EMP"."JOB" as "JOB",
          "EMP"."MGR" as "MGR",
          "EMP"."HIREDATE" as "HIREDATE",
             CASE 
             WHEN SAL > 1700 and DEPTNO = 10 THEN 
             '<span style="color:#RED#;font-weight:bold">'
             || SAL 
             || '</span>' 
             ELSE to_char(SAL)
             END SAL ,
          "EMP"."COMM" as "COMM",
          "EMP"."PROSTARTDATE" as "PROSTARTDATE",
          "EMP"."DEPTNO" as "DEPTNO",
          "EMP"."PROENDDATE" as "PROENDDATE" 
     from      "EMP" "EMP"
    but output is wrong.
    can you pls help in this issue.

    i took this code from http://forums.oracle.com/forums/thread.jspa?messageID=3339427&#3339427

    result is :

            Empno  Ename Job Mgr Hiredate Sal Comm Prostartdate Deptno Proenddate 
         1111     -     -     -     -     <span style="color:#RED#;font-weight:bold">1789</span>     7566     -     10     -
         7839     7698     PRESIDENT     -     17-NOV-81     <span style="color:#RED#;font-weight:bold">5000</span>     -     -     10     -
         7698     BLAKE     MANAGER     7839     01-MAY-81     2850     -     23-MAR-11     30     28-MAR-11
         7782     CLARK     MANAGER     7839     09-JUN-81     <span style="color:#RED#;font-weight:bold">2450</span>     -     29-MAR-11     10     31-MAR-11
         7566     JONES     MANAGER     7839     02-APR-81     2975     -     -     20     -
         7788     SCOTT     ANALYST     7566     09-DEC-82     3000     -     22-MAR-11     20     29-MAR-11
  • 14. Re: Background Colour of Report Cell Issues.
    fac586 Guru
    Currently Being Moderated
    Ensure the Display Text As column attribute is Standard Report Column rather than the default Display as Text (escape special characters).

    Edited by: fac586 on 15-Apr-2011 14:18

    There's also something else wrong somewhere:
    <span style="color:#RED#;font-weight:bold">1789</span>
    <tt>#RED#</tt> shouldn't be appearing like that: check the column aliases and HTML Expressions...
1 2 3 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points