Color report rows based on a value in that row

I would like to Color report rows based on a value in that row.
For examplle with the "EMP" table:
I would like job=MANAGER to be red and job=CLERK to be green etc etc
The other example I found only had the option of one color either the highlight or the default color.
I am looking for a way to do multiple colors.

Hi,
In the row template, you can use #1#, #2#, etc to indicate where a field in the report needs to be output. This does not have to be plain text - ie, you can use it within style tags if you like.
So, take a query like:
SELECT EMPNO,
ENAME,
DEPTNO,
DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
FROM EMPYou get columns 1=empno, 2=ename, 3=deptno and 4=bg_colour. In the row template, you can then do:
Before Rows setting (sets up the table):
<table>
<tr><td>ID</td><td>Name</td><td>Dept</td></tr>After Rows setting (closes the table):
</table>Row Template 1 (used for ALL rows):
<tr style="background-color:#4#;"><td>#1#</td><td>#2#</td><td>#3#</td></tr>Then, for every row, the colour that has been calculated using the DECODE function will be used in the style tag to colour the background for the entire row.
How you determine the colours is up to you. I've used DECODE here, but you could use a field on the DEPT table to hold this and use this in your SQL statement.
Andy

Similar Messages

  • Count the number of rows based on the values!!!

    Hi all,
    What I am using:
    I am working with a multidimensional database in Visual Studio 2010 using its Data source view and calculation member and dimension usage.
    What I want to do:
    I have a fact table that has five columns(leg(s),hand(s), Head and body,overall) that shows the category of how severe the injury is. Let say for the records all columns never have an empty value(no injury is stated with 'No injury' ) . These five columns
    are connected with a dimension that has all the available values (Category A-E of injury).The overall has the most severe from the other four columns. I want to create a bar chart with five different measure
    values, one for each column, and count the values in those columns. 
    For example : I have a slicer in the excel and a bar chart and the slicer has all the values of the Category of the injury ( Cat a,Cat B, Cat C, ... Cat E, No injury ) and when i select one of them, lets say
    Cat C,  the bar chart should update and show how many Cat C each measurement column has. 
    Example FACT table:
    ID      LEG      HAND    HEAD   BODY OVERALL
    1        No         A           No        No        A
    2        No        D            C          C         C
    3    E         C            D           A         A
    4         E          E           B            C         B
    So if i selected C the bar chart will count   (Leg = 0, Hand = 1, Head = 1, body = 2 and Overall = 1).
    Any ideas ?
    Thanks for the help and the time :) 

    Hi DBtheoN,
    According to your description, you want to create a chart on excel worksheet to count the rows based on the value, right? If in this case, I am afraid this issue is related to Office forum, I am not the expert of Office, you can post the issue on the corresponding
    forum.
    However, this requirement can be done easily on SQL Server Reporting Services. You can using the expression below to count the rows.
    =COUNT(IIF(Fields!LEG.Value=Parameters!TYPE.Value,1,NOTHING))
    Regards,
    Charlie Liao
    TechNet Community Support

  • ADF Table cell color based on the value in that field

    Dear All,
    I want to create a table for our new application which contains a table used to represent the data in a chart format or matrix format,
    and each cell of the table should be filled with a colour out of three colors, based on the value belongs to which range eg:(1-8 ->green, 9-20 - yellow etc),
    I dont know how to implement this. Please help...
    Ranjith

    Check this out.
    How to highlight ADF table row based on column value?
    -Arun

  • Multi-record report: content LOV depending on value of current row

    I have a multi-record report based on a query.
    For each row in the report it should be possible to choose a value from lov.
    The content of the lov is depending on a field in the current row.
    Later on I will update a record based on the chosen value but that is not the
    issue right now.
    The problem I am facing is that I don't know how to refer in a list to a value
    from the current row.
    For example.
    In the example below it should be possible to choose (from the lov) a best buddy for
    an employee. The buddy should be an other employee working for the same department.
    So in the lov I must refer to the deptno from the current row. How is this possible???
    select empno
    , ename
    , deptno
    , htmldb_item.select_list_from_query
    ( 1
    , empno
    , 'select ename, empno from emp where deptno = #deptno# '
    ) buddy
    from emp

    Hi Scott,
    I've created this application "TestLov" at the site you mentioned.
    Application ID : 800
    Workspace Name : ANUWKSPC
    The first page has an employee report with the solution as suggested by Raju Mattamal in this thread. That query seems to work fine without any errors...(I'm surprised why I'm getting errors on my application with the same query, even though data appears?! Is it to do with some setting?)
    The second page has the report with my actual query. This is throwing errors.
    On the third page I've tried to implement the solution you've suggested in Tips & Tricks section of HTML DB Studio(Simulating a correlated sub-query in report LOVs)
    http://htmldb.oracle.com/pls/otn/f?p=18326:54:2188928890822530056::::P54_ID:1282
    This doesn't seem to work either.
    I'm unable to figure out the problem.
    Pls look into the application and let me know how I shld go abt this.
    Thanks in advance,
    Anu

  • How can I select and delete rows based on the value in one column?

    I searched through the discussion board, and found a thread on deleting blank rows, but not sure how to modify it to work with my issue.
    I have put together a rather complicated spreadsheet for designing control systems, it calculates parts needed based on check boxes selected in a second spreadsheet.
    Since not all systems require all parts there are many rows that have a 0 quantity value, I would like to select these rows and delete them once I have gone through the design phase (checking off required features on a separate sheet).
    I like the way the other thread I found will gather all the blank rows at the bottom without changing the order of the rows with data in them.
    I don't understand exactly how the formula in the other thread works well enough to modify it to look for a certain column.
    I hope I made myself clear enough here, to recap, I would like to sort the rows based on a zero value in one (quantity) column, move them (the zero quantity rows) to the bottom of the sheet, and then delete the rows with a zero quantity (I can delete them manually, but would like to automate the sorting part).
    Thanks for any help anyone can provide here.
    Danny

    I apologize but, as far as I know, Numbers wasn't designed by Ian Flemming.
    There is no "this column will be auto-destructing after two minutes"
    You will have to use your fingers to delete it.
    I wish to add a last comment :
    if your boss has the bad habit to look over your shoulder, it's time to find an other one.
    As I am really pig headed, it's what I did. I became my own boss so nobody looked over my shoulder.
    Yvan KOENIG (VALLAURIS, France) mercredi 13 juillet 2011 20:30:25
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Color APEX charts based on query value returned?

    Hi,
    I appreciate any information regarding this topic. Do you know if there is a way to change the color of a column chart based on the value that is returned in SQL query? This specific type of query and chart only has one bar...so we don;t have to worry about multiple series of bars here.. For example,
    select null link, FTE_NAME label, (SUM(INVOICeABLE_ALLOCATION) + SUM(SECOND_BILL_ALLOC)) value1
    from FTE_VIEW
    WHERE FTE_ID = :P9_ID
    group by FTE_NAME
    This might return an allocation of 2.5 for a specific person, where we only want people allocated to 1.0 so anything > 1.0 the chart color would turn red.
    PS: There is a reason we are allowing them to enter values >1.0 by the way ;) if you are wondering..haha
    Any ideas? I also looked up in the AnyChart knowledge base, but could not find any help there..
    Kind Regards,

    Hi,
    Thanks for your help. I am not clear on whether I need to create the :P1_Colors item or not. If I choose Custom colors and then have my colors as #099E4A,#F00E19 can I reference :P1_COLORS in my SQL or do I have to create the item :P1_COLORS and use a statics list? Also I've playing with the SQL, I was able to get a return value using a CASE statement, but I had no lukc with the Decode...Here is what I tried IN SQLdeveloper but could not get it to work.
    SELECT FTE_NAME, DECODE(SUM(ALLOCATION),SUM(ALLOCATION)<=1,'GREEN','RED') AS COLOR
    FROM FTE_PRJK_VIEW
    where id = :P9_ID AND FTE_PROJECT_STATUS = 'YES'
    group by FTE_NAME
    (Where i have Green and Red I would have the item :P1_COLORS = #099E4A,#F00E19, ETC..)
    Was able to get this case statement to return a value in SQL Developer..but cannot get it to work in the chart...
    select null link, FTE_NAME label,
    CASE WHEN SUM(ALLOCATION)<1
    THEN :P1_COLORS = '#099E4A'
    else :P1_COLORS = '#F00E19'
    END CASE value1
    from FTE_PRJK_VIEW
    where id = :P9_ID AND FTE_PROJECT_STATUS = 'YES'
    group by FTE_NAME
    Really Appreciate the help with this :)
    Kind Regards,

  • Combine rows based on column value

    I'm trying to combine rows based off of a common value.
    Table Data:
    Result A
    Player_ID   Player_Name  Team_Name  Points Sequence
    99999       John Smith    Bulls              50         1
    99999       John Smith    Pistons          14         2
    What i want in the output
    Result B
    Player_ID Player_Name Team_Name  Points
    99999     John Smith      Bulls           64 (50 for Bulls)Here's my main query...
    select player_id, player_name, team_name, points
    from
              SELECT player_id, player_name, team_name, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id, player_name, team_name
              ) t
    ORDER BY sum_points DESC, last_name;**The current query gives me the output from Result A
    1) Not entirely sure how to combine data based of player_id
    2) Once i figure out 1, im sure by adding the ('sum_points' for 'team_name') to the output can be done with a case statement, i think?

    Sorry about that Frank.
    Using: Oracle 10.2g
    i was incorrect about the output of the query
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    )Output
    Player_ID      Sum_Points    
    99999              20        
    55455               6          
    66489               2  So the subquery is outputing the correct data
    The output of the original entire query(that you had posted) is:
    Player_ID    Player_Name   Team_Name    Points    
    99999        John Smith      Bulls               16 (8 for  Bulls)    
    55455        Bob Johnson    Rockets          6   (3 for Rockets)
    66489        Chris Terry       Kings              2   (1 Kings)Here's some more raw sample data from the table:
    Player_ID    Player_Name   Team_Name    Points     Sequence  Game_Type_ID Team_ID
    99999        John Smith      Bulls               12          1                       1                  5
    99999        John Smith      Bulls               0            1                      -1                  5
    99999        John Smith      Pistons            4           2                       1                 12
    99999        John Smith      Pistons            0           2                       -1                12
    55455        Bob Johnson    Rockets          4           1                        1                  3 
    55455        Bob Johnson    Rockets          0           1                       -1                  3 
    66489        Chris Terry       Kings              2           1                        1                  8
    66489        Chris Terry       Kings              0           1                       -1                  8So your code frank is very close, the issue is that:
    A) All players have a ('pt value' for 'team name') even if they played on the same team, which can prob. be solved with a case statement, which i tried to do in my last post.
    WITH       grouped_data     AS
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    SELECT     g.player_id
    ,     s.player_name
    ,     s.team_name
    (case when sequence = 2 then g.sum_points  <==
         ||  '('
         ||  TO_CHAR (s.points)
         ||  ' for '
         ||  s.team_name
         || ')'
    else to_char (g.sum_points)
    END)     AS points
    FROM     grouped_data     g
    JOIN     stats_data     s     ON g.player_id     = s.player_id
    WHERE     s.sequence     in (1,2)     <==
    AND     s.season_id     = 2008
    AND     s.points     > 0;the output has two issues, for players who played on more than one team, like Josh Smith the output comes out as
    99999        John Smith      Pistons           20  (2 for Pistons)        
    99999        John Smith      Bulls               20While the players who played on one team came out correctly. So issue with my edit of your code is:
    A) josh smith is output 2, needs to be output once
    B)josh smith should say (Josh Smith Bulls 20 (4 for Pistons) not "99999 John Smith Pistons 20 (2 for Pistons)"
    c) Issues with "99999 John Smith Pistons 20 (2 for Pistons)" is that it listing the wrong team for him: should be Bulls and listing half of his total with the pistons in the prentices should be 4. --The reason that is because s.points needs to be summed as based off of the data there's two entries
    Hope this clears it up, thanks!
    Edited by: user652714 on Mar 11, 2009 9:28 AM

  • Update multiple rows based on two columns in same row

    I have a 1000 rows in a table I would like to update with a unique value. This unique value is a cocatenation of two columns in teh same row.
    Each row has a (i) date and a (ii) time and a (iii) date_time column. I would like to update the date_time (iii) column with a cocatenation of the (i) date and (ii) time columns.
    I know how I would update a single row but how can I update multiple rows with a cocatenation of each of the two columns - i.e put a different value into the date_time column for each row?

    this?
    update table tab_name
    set date_time =date||time
    where your_condition

  • How to change the chart color in report 6i based on its value?

    I built a simple chart using Chart Wizard in Report 6i, with X axis = supplier and Y axis = rating. I want the chart to show different color for certain rating, eg: above 80% => red color.
    Anyone know how to do this?
    Pls help!

    Hi Resham,
    In SP list, you change the background color of field value using Content editor and javascript.
    Add the content editor webpart on the list page with javascript which highlight the particualr value based on the condition.
    You can refer to following link
    http://blog.pathtosharepoint.com/2009/02/26/highlight-rows-in-sharepoint-lists/
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • Populating apex item checkbox in report row based on database value

    Hi All
    I am looking for help setting an apex item checkbox to 'checked' depending on a record exisiting in a database and I would appreciate a little guidance.
    At the moment I have a report which looks a bit like this
    SELECT licence_user_identifier,
    description,
    licence_name,
    apex_item.checkbox(22,licence_id)
    FROM TABLE(SOL_LICENCE.F_RETRIEVE_ORG_LICENCES ( 121 ));
    4 columns and the last column is a checkbox called 'assign' and is used to assign the selected licence to a user(who is already displayed on the page in another table). There is save button which when clicked saves a record to the database if the checkbox is selected.
    However when the page is displayed the checkbox should be prepopulated/checked if there is a record in the database saying that the licence is assigned to the current user. I have created a page process to try and collect this information and populate the checkboxes on load - before header. However I am having difficulty referencing the apex_application item the corresponds to each row because when I use the FOR i IN 1 .. apex_application.g_f22.COUNT LOOP it only selects the item if it is checked. Can anyone point me in the right direction?
    here is the process I have to populate the checkboxes, it is not getting to my flow.debug as there are no selected checkboxes:-(
    DECLARE
    v_count     NUMBER;
    CURSOR getlicences (p_co_id so05.co_id%TYPE)
         IS
    SELECT     licence_id
    FROM     so05_cust_org_licences
    WHERE     co_id = p_co_id;
    BEGIN
         IF :p9_co_id IS NOT NULL
         THEN
              FOR each_rec IN getlicences (:p9_co_id)
              LOOP
                   --check if a record exists
                   SELECT     COUNT ( * )
                   INTO     v_count
                   FROM     so05_cust_org_licences
                   WHERE     co_id = :p9_co_id AND licence_id = each_rec.licence_id;
    --if the record exists populate the checkbox
                   IF v_count > 0
                   THEN
                        FOR i IN 1 .. apex_application.g_f22.COUNT
                        LOOP
    wwv_flow.debug ('bbbbbbbbbbccccccccccandwearein' || v_count);
                             IF apex_application.g_f22 (i) = each_rec.licence_id
                             THEN
                                  apex_application.g_f22 (i) := 1;
                             END IF;
                        END LOOP;
                   END IF;
              END LOOP;
         END IF;
    END;
    Thanks in advance
    Lynn

    Hi,
    Sorry my mistake. You can use the above link only to solve this problem, for this you have to use a hidden column to which you will assign 'Y' or 'N' as mentioned in that post.
    using that hidden column value you can fire your query accordingly.
    let's say your hidden column is f01 and checkbox column is f02 and the id column is f03, you can do like this
    create a process before your update process like this
    BEGIN
        -- Reset the hidden ADMIN_USER flag for all visible records to N
        -- Note: g_f01 maps to the hidden ADMIN_USER column
        FOR ii IN 1 .. APEX_Application.g_f01.COUNT
        LOOP
            APEX_Application.g_f01(ii) := 'N';
        END LOOP;
        -- Set the hidden ADMIN_USER flag for those records where the
        -- checkbox has been set by the user to Y
        -- Note: g_f02 is the checkbox column ADMIN_USER_CHECKBOX
        FOR ii IN 1 .. APEX_Application.g_f02.COUNT
        LOOP
            APEX_Application.g_f01(APEX_Application.g_f02(ii)) := 'Y';
        END LOOP;
    END;then write a new process positioning after above process
    if apex_application.g_f01 = 'Y' then
      your update query using id column (f03)
    else
      your delete query using that id column (f03)
    end if;hope this helps you.
    Thanks
    Tauceef

  • Report headings based on Items: values not substituted in BI Publisher

    That is, custom column headings such as "&P7_HEADING_X.".
    They show up fine as the item values in the browser report, but as the literal ("&P7_HEADING_X.") in BI Publisher output to Excel, Word, etc.
    I've noticed that PL/SQL based headings pass through all right. I can probably use this as a work-around. Is there a way to get BI Publisher to do the item value substitutions ?
    I am working with Application Express 3.1.0.00.32 on apex.oraclecorp.com.
    I've just been introduced to BI Publisher (like today). All I know about it is that you get to it through the Print Attributes panel.

    Mike said: "I am assuming that you are just using the default download and I use the "&." notation in the column headings so it should pass over to word, or excel."
    Yes, this is it. But, when the column headers pass through BI Publisher, they are not substituting (like you said, they "should" but they don't). I wind up with an Excel (or Word, or PDF) file where the column headings are all '&P7_HEADING_01.', '&P7_HEADING_02.', etc.
    Again though, all I know about BIP is that it hooks into APEX by way of the Report "Print Attributes" panel. And, I'm not even so sure about that; there's no indication what's doing the "print" serving behind the scenes.

  • Urgent - Report Column based on LOV - Value not found in LOV

    Hi All,
    Recently, we have upgraded to HTMLDB 2.0 from HTMLDB 1.5.
    I have a SQL report. One of the columns is based upon LOV - Display as Text (Based on LOV, does not save state).
    For the "Ids" of the report, it should display the corresponding "Names" from the LOV.
    But, for the cases, where no record exist in LOV for some Id, then it is directly showing the Id instead of "-" (which i have specified in Display Null Text) in the report column attributes.
    Before upgrade, it was working fine.
    Any idea where is the issue.
    Please help.
    Thanks in advance,
    Monika

    Hi,
    Can anybody help me in sorting out this issue please.
    For your reference, i have made a test case on
    http://apex.oracle.com/pls/otn/f?p=20451:4:3519837362944582:::::
    Here, there are 2 tables
    1. MY_EMP_COUNTRY(emoid, empname, cntry_id)
    2. MY_COUNTRY_LOOKUP(id, name,active)
    LOV is created on table 2
    select name d, id r
    from my_country_lookup
    where active = 'Y'
    And, on the page a SQL report is created
    select empname, cntry_id
    from my_emp_country
    where, cntry_id is based upon the LOV.
    Since, in lookup table, cntry_id = 4 is set inactive, it is not picked up by the LOV and hence on the report instead of showing the NULL text it is showing the cntry_id (4).
    The attributes of report column cntry id -
    Named LOV = CNTRY_LOV
    Display Null = YES
    NULL text = -
    Display Extra Value = YES
    Am I missing anything.
    thanks,
    Monika

  • Interactive Report - How to display Aggregate values in first row

    Hi,
    I have an interactive report in which I have included aggregate for count.
    But the count doesn't show until I navigate to the last page of the report.
    Any idea how to display all the aggregate values on the top(in first row), so that the user doesn't have to click next to see these values.
    Also when I downloaded the report the aggregate columns are not exported into csv. Any thoughts on this highly appreciated.
    Thanks,
    Raj.

    Any help on this guys ?

  • Changing field text color and fill based on input value.

    I am trying to create a field that can be red, yellow or green.  In the end, what I need is a box that can be made red, yellow or green by the form user.  My strategy is to use a validation script to change the field and text color based on the field input.  So if you type "red", the text and field turn red, essentially making a red box.  The field is named "GoalColor".
    Am I headed in the right direction to get make this dynamic colored box?
    This script works but you must type "red" into the field(including quotation marks).  Any ideas on why the word red alone isn't triggering it? 
    var vcolor = this.getField("GoalColor").value;
    if (vcolor == "red") {
        this.getField('GoalColor').fillColor = color.red;
    } else {
        this.getField('GoalColor').fillColor = color.white;
    I have also tried - works if you type 'red'
    var vcolor = this.getField("GoalColor").value;
    if (vcolor == 'red') {
        this.getField('GoalColor').fillColor = color.red;
    } else {
        this.getField('GoalColor').fillColor = color.white;
    and  - does not work
    var vcolor = this.getField("GoalColor").value;
    if ( vcolor == red ) {
        this.getField('GoalColor').fillColor = color.red;
    } else {
        this.getField('GoalColor').fillColor = color.white;
    Thanks!

    And you don't need to add the quotation marks in the text field. In fact, doing it will cause the script not to identify the word.

  • Insert rows based on column value

    I have customer_ no., Date and no_months as columns. I need to insert in a new table the customer_no as many times as the value of no_months column. Meaning if customer_no is 001 and if months value is 3 then in the new table I want three rows having customer_no as 001 and the date. Any help is highly appreciated.

    Something like this?
    SQL> with t
      2  as
      3  (select 23 cust_no,3 mon from dual
      4  union all
      5  select 10,9 from dual
      6  union all
      7  select 5,12 from dual
      8  union all
      9  select 7,1 from dual
    10  )
    11  select cust_no,mon
    12  from
    13  (
    14  select cust_no,mon,row_number() over(partition by cust_no order by cust_no) rn from t,dba_tables
    15  )
    16  where rn<=mon
    17  /
       CUST_NO        MON
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
       CUST_NO        MON
             5         12
             7          1
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
       CUST_NO        MON
            23          3
            23          3
            23          3
    25 rows selected.
    SQL>

Maybe you are looking for