Showing particular row in a color depending on a column in classical report

Hi,
I have a classical report with a column as "Affirmation Status". This column can take three value as "Affirmed, Rejected or NA". My requirement is I have to show all row in one color like red wherever it has value affirmed, and all row in color like green wherever it is rejected.
Pls give some idea.

Hi chandra Bhanu,
create PL/SQL Dynamic content region for your report for showing the row in different color on the basis of conditions
i am giving you sample code..you can modify according to your requirement
declare
cursor emp_data
is
select empno,ename,sal,status from emp;
begin
htp.p('<table width="100%" bgcolor="#DCE6F1"><tr>');
htp.p('<td width ="20%"><b>Empno</b></td>');
htp.p('<td width ="20%"><b>Employee Name</b></td>');
htp.p('<td width ="20%"><b>Salary</b></td>');
htp.p('<td width ="20%"><b>Status</b></td>');
htp.p('</tr></table>');
for c_emp_data in emp_data
loop
htp.p('<table width="100%"><tr><td>');
if c_emp_data.status = 'Affirmed' then
htp.p('<TABLE width="100%"><tr bgcolor="#FF0000">');
htp.p('<td width ="25%">'||c_emp_data.empno||'</td>');
htp.p('<td width ="25%">'||c_emp_data.ename||'</td>');
htp.p('<td width ="25%">'||c_emp_data.sal||'</td>');
htp.p('<td width ="25%">'||c_emp_data.status||'</td>');
htp.p('</tr></table>');
elsif  c_emp_data.status = 'Rejected' then
htp.p('<TABLE width="100%"><tr bgcolor="#006400">');
htp.p('<td width ="25%">'||c_emp_data.empno||'</td>');
htp.p('<td width ="25%">'||c_emp_data.ename||'</td>');
htp.p('<td width ="25%">'||c_emp_data.sal||'</td>');
htp.p('<td width ="25%">'||c_emp_data.status||'</td>');
htp.p('</tr></table>');
else
htp.p('<TABLE width="100%"><tr>');
htp.p('<td width ="25%">'||c_emp_data.empno||'</td>');
htp.p('<td width ="25%">'||c_emp_data.ename||'</td>');
htp.p('<td width ="25%">'||c_emp_data.sal||'</td>');
htp.p('<td width ="25%">'||c_emp_data.status||'</td>');
htp.p('</tr></table>');
end if;
htp.p('</td></tr></table>');
end loop;
end;Hope this will helps you.
Regards,
Jitendra

Similar Messages

  • How to show alternate rows in different colors?

    How to show alternate rows in different colors?
    Thanks

    you should put these kind of stmt in the if condition for even row and odd row
    <xsl:attribute xdofo:ctx="block" name="background-color">yellow</xsl:attribute>
    this should help you
    Re: About highlight row
    http://blogs.oracle.com/xmlpublisher/2007/08/09
    http://garethroberts.blogspot.com/2007/09/bi-publisher-color-list-and-cell.html

  • Changing a row colour in JTable, depending on a column value

    Hi,
    I need assistance with the following:
    I need to change the colour of a row in a JTable, depending on a column value. I have been successful on changing one column's colour in each cell, depending on the value by using a CellRenderer extending DefaultTableCellRenderer.I am unable to set the other 2 columns's cell's depending on the first column value's.
    I would appreciate any help, source would be a bonus.
    Thx
    Charl

    Ok, here follows the code as requested. Note that this is the code setting each row in one of my columns depending on the value. Now i have to cgange column0 and column1 's foreground the same as what this column (column2) 's foreground is. Thx
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    class ColorizedCell extends DefaultTableCellRenderer {
    static Hashtable cache;
    static {
    cache = new Hashtable();
    cache.put ("Device Responding to Poll",Color.green);
    cache.put ("Wan link Recovered",Color.green);
    cache.put ("No Response to Device Poll",Color.yellow);
    cache.put ("Wan Link Failure",Color.red);
    cache.put ("Lan Link Failure down",Color.red);
    cache.put ("Device Down",Color.red);
    public Component getTableCellRendererComponent(JTable table,
    Object value, boolean isSelected,
    boolean hasFocus, int row, int column)
    JLabel label = (JLabel) super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
    label.setText((String)value);
    if(column == 2) {
    //setFont(bold);
    Color c = (Color)cache.get(value);
    label.setForeground(c);
    if (isSelected) {
    label.setOpaque(true);
    label.setBackground(Color.white);
    else {
    //setFont(plain);
    label.setForeground(Color.white);
    return label;
    }

  • Colour coding a report depending on one columns' data

    Hi All,
    I have no experience with CSS but i need to edit my report to show various rows in difrerent colours depending on the data in a single column ( STATUS ).
    Does anybody have a CSS file that i could just edit the table details in to acheive this ?
    Thanks

    The key is the row template:
    <tr class="#5#"><td>#1#</td><td>#2#</td><td>#3#</td><td>#4#</td></tr>
    (#5# is column 5 in your Query)
    where class sets the background color:
    tr.class1 td{background-color:#FFCCCC;}
    tr.class2 td{background-color:#CCFFCC;}
    tr.class3 td{background-color:#CCCCFF;}
    The 3 classes switch, depending on the deptno:
    decode(deptno, 10, 'class1', 20, 'class2', 30, 'class3') trclass
    But it seems that the report source is not correct !!
    trclass is defined as Column1 but refered as Column5
    Correct report source would be:
    select ename, job, sal, comm,
    decode(deptno, 10, 'class1', 20, 'class2', 30, 'class3') trclass
    from emp
    greetings,
    Jochen

  • Heading and color scheme of the columns for the detail report

    Is it possible to have a heading and color scheme of the columns for the reports displayed on drill down of a query in WAD?

    Try the stylesheet in the properties of web template.

  • Change the color of a particular row in a jtable

    I have a jtable and i want to change the color of one particular column and few rows to blue and underline the text depending on some condition. In my view class if a condition is true
    for( count=0;count<grdTest.getRowcount;count++)
    if(some condition true)
    grdTest.getColumnModel().getColumn(0).
    setCellRenderer(new MyTestCellRenderer(count));
    And my cell renderer
    public class MyTestCellRenderer extends DefaultTableCellRenderer {
    int rowIndex=-1;
    public MyTestCellRenderer(int rowcount) {
    super();
    rowIndex=rowcount;
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value,
    isSelected, hasFocus, row, column);
    if(row == rowIndex)
    setText("<html> <u> <font color='blue'>" + value.toString());
    return this;
    This is behaving very wierd . If suppose there are 50 rows and all of them have the condition true then only the last one in the row color is changes.
    However if only one out othe say10 has the condition true then it changes the color and underlines the particular row,column.
    Is there any other way to do this or what i am doing wrong
    Thanks

    if(row == rowIndex)Your code is a shambles because of the lack of tags, but I don't believe I see anything being called when this boolean condition is not true. That would be a problem.                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to change the background and font color of a particular row in table

    Hi,
       i need to change the background and font color of a particular row. I am using textview as table columns. I tried to do it using semanticColor property of textview  but the font color get changed for the whole column. But i want to change the color of a particular row only.
       If anybody knows please help me(give an example if possible).
           Thanks and regards.
            Pankaj Kumar.

    Hi Pankaj,
    In your data source context node (context node which is bound to dataSource property of Table UI elemennt) do following:
    If data source node is model node: create a value node under data source node, cardinality 1..1, selection 1..1, singleton false. In this new node add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor .
    If datasource node is value add value attribute and set property readOnly=true, calculated=true, property com.sap.ide.webdynpro.uielementdefinitions.TextViewSemanticColor.
    In calculated getter method put your color calculation depending on conditions, like:
    return <condition>
      ? WDTextViewSemanticColor.CRITICAL
      : WDTextViewSemanticColor.STANDARD;
    Bind new created attribute with property semanticColor of textview.
    Best regards, Maksim Rashchynski.

  • Colouring Rows of a Table depending on a particular condition.

    Hi,
        The problem I am facing is coloring specific rows of a table depending on the satisfaction of a particular condtion. For example: All rows having the value in the amount column greater than 1000 have to be coloured in red and the remaining yellow.
         Can anyone please help me out with this row-coloring problem?
    Regards,
    Gaurav.

    Hi Martin,
    Have used an image column to display image.
    You can define the condition in the URL field, to display the image. Something like:
    =IF(@img=="50",store@IMAGE_URL&"Green_dot.png",IF(@img=="40",store@IMAGE_URL&"Yellow_dot.png",IF(@img=="39",store@IMAGE_URL&"Red_dot.png","")))
    Where store@IMAGE_URL has the URL to the location where the images are stored.
    Let me if it helps.
    Regards,
    Dharmi

  • How to print the row  ,column,and particular cell in separate color

    how to print the row  ,column,and particular cell in separate color IN ALV GRID

    HI,
    Here you go good program links
    <a href="http://www.sapfans.com/forums/viewtopic.php?t=52107">How to Set Color to a Cell in AVL</a>
    <a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm">ALV Grid Coloring</a>
    Thanks
    Mahesh

  • How to set the color to the particular row in a report

    Hi
    I have a report in which I have an edit link(I changed the id as edit link)..When I click that link, all the details(the whole row details) will be appearing on the items nearer to the report to save the changes....
    I want to set the color for the particular row when a link is clicked and the color should not be changed until I save the changes in items...After saving the changes, the report should come in the normal color...this is my requirement..i refered many forums regarding this...But could not find solution....If anyone knows,please help me...
    Fazila

    Here is how I would implement
    Create renderer
    Add SkinnableContainer element and create a skin for this container namely SkinnableContainerSkin
    find the fill section in the skin
    add bitmap fill to the fill section and give the source of the image which you are planning to use(Hopefully this is a direct way of doing, may be you need to hack this a little to get it to work)
    I've never tried this, but should help you give some idea.

  • How to color a particular row in a matrix

    Hi All,
    Using SBO, i am having two queries:
    1. Is it possible to color single row, Cell in a matrix or a grid by any way.
    2. And How to copy particular row from 1 matrix to another?. I want this by using drag n drop event of mouse. Only click and right click mouse events are available in SBO. But I want to use mouse down and mouse up events..Please help me, it's urgent.
    Thanks in advance.

    Hi,
    1) No, unfortunately, you cannot colour either a row or a single cell in the current versions of the matrix and grid controls. As a workaround, I use an image column as the first column in my matrices and then put coloured squares in this column for rows that I want to 'highlight'.
    2) You can't drag and drop using the SBO controls. Personally, I use the right-click event and add a menu option to copy the selected rows to the other matrix and it works fine. Click is the Mouse Down event and Item Pressed is the Mouse Up but it is not fully supported on matrices or grids.
    Kind Regards,
    Owen

  • Changing font size(bold) or color of a particular row in ALV Grid Digplay

    Hi Experts ,
    I am having a requirment to highlight some particular rows in ALV Grid Display . To achieve this i need to change font size or make it bold or change color of that row .
    Please give me some inputs .
    Thanks in Advance.
    Vijyeta

    Hi
    Coloring An Entire Row
    Coloring a row is a bit (really a bit) more complicated. , you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row.
    First you have to declaration of our list data table u201Cgt_listu201D.
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA END OF gt_list .
    Adding the field that will contain row color data
    As you guess, you should fill the color code to this field.  But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field u201CINFO_FNAMEu201D of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. u201Ce.g. u2018ROWCOLORu2019
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    Try this link also:
    Possible functionalities in ALV
    Regards
    Neha

  • JTable:  Howto: Row color depending on value

    Hi all
    I would like to write a cell renderer that changes the background color of a row (or indivicual cells) depending on the value in one of the table columns. For example, if the value in column 'recursive' of a given row is 'true' then make the row (cell) backgroundd grey. if 'false' make white.
    I ve been able to write a simple cell renderer:
    public class colorTableCellRenderer extends DefaultTableCellRenderer
    java.awt.Color recursiveBG = new java.awt.Color(240, 240,240);
    public colorTableCellRenderer()
    super();
    public void setValue(Object value)
    String text = (String)value;
    this.setBackground(recursiveBG);
    this.setText(text);
    But i am lost on how to actually check the value of the other column so I can determine which color to choose.
    Help is greately appreciated.
    Cheers,
    michael

    Hi Laszlo
    Ok, I think this needs an explanation. Here is what I want to do:
    1. Depending on the value of column 0 compared to an external value (referenced), I want to mark a row by setting the background of the row to recursiveBG. All others should have a white background.
            if(selectedPerson.equals(sourceID)) // row is not recursive
              this.setBackground(Color.white);
            else // row IS recursive
              this.setBackground(recursiveBG);
              }This should just set the background color of the cell. If I select the row, the 'normal' behaviour should mark the row blue (or whatever is standard). Your counting is right, these states should be accomodated for.
    Current full code is below:
    public class colorTableCellRenderer extends DefaultTableCellRenderer
      java.awt.Color recursiveBG = new java.awt.Color(240, 240,240);
      int recursiveColumn = 4;
      String recursiveID = null;
      Connect connectRef = null;
      public colorTableCellRenderer(Connect connectRef)
        super();
        this.connectRef = connectRef;
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
            java.awt.Color recursiveColor = new java.awt.Color(240,240,240);
            String myVal = (String)value;
            this.setText(myVal);
            recursiveID = (String)table.getValueAt(row, recursiveColumn);
            String selectedPerson = connectRef.getSelectedPersonPID();
            String sourceID = (String)table.getValueAt(row, 6);
            if(selectedPerson.equals(sourceID)) // row is not recursive
              this.setBackground(Color.white);
            else // row IS recursive
              this.setBackground(recursiveBG);
              return this;
    [/CODE]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Making particular rows as non editable before displaying the TABLE

    Hi everyone,
                               I would like to know how to make a particular rows as non editable in UI element "TABLE" before it is displayed . The scenario is :
    On entering the Personnel number, I am getting family dependants in the table. Then, I am selecting any of the family members on some condition and saving each member with the request.
    Next time when i enter the same personnel number, I would like to show the table with already saved request for the family members rows as non editable & other members row as editable.????
    Please provide a feasible solution.

    Hi Pradeep,
    follow as per suggested. if not work use cell variants concept. it will work.
    Please check this wiki...
    http://wiki.sdn.sap.com/wiki/display/WDABAP/WebDynproforABAPCellVariants
    Cheers,
    Kris.

  • AnyGantt: How to set different bar color depending on data value.

    Need to have different colors for bars in a gantt resource chart.
    The color depends on certain data value not included in the visible part of the chart, so it must be provided 'extra' for the chart in some way without beeing visible.
    Have studied some examples but cannot figure out the mechanism for this, and the procedure to implement it.
    Any ideas?
    Apex 4.2.2
    Regards
    Per.

    Hi Per,
    You mention "+Among the samples I can see that it has been implemented, but not how.+" - in the Information region below the chart that Tony referred to (https://apex.oracle.com/pls/apex/f?p=36648:50) that I've stated the following:
    "The elements of the Timeline region have been customized via the Chart Attributes page, using the following settings: *Custom Colors*: #000000,#00FF00,#0033FF"
    So that's how I applied custom colours to that particular chart. However, that declarative option won't meet your requirements, where the colours you wish to apply are dependent on data not included in the chart series query. You mention "+Now, if I add another column to the statement I get a yellow error message telling that the statement is not valid.+". It is not possible to simply add an additional column to the chart series query. Each supported chart type expects the associated chart series query to use specific syntax - see About Creating SQL Queries for Charts in Chapter 10 of the APEX User's Guide, http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/bldapp_chrt.htm#BCEIJJID.
    So to answer your question "+How to add the new value if not providing another column to the graph?+", if you wish to customise your chart to that extent, then you will need to use custom XML. Depending on what exactly you're trying to achieve, this may require the generation of custom data for your chart. If you edit your chart, and take a look at the Custom XML region, you'll notice a substitution string, #DATA#, towards the end of the XML. When a chart is rendered, we use the chart series query to generate the necessary XML to represent the data on the chart, replacing the string #DATA# with the actual XML. The format of the data XML generated for gantt charts uses a bar style called "defaultStyle", and this handles the default appearance of the bars in the timeline region e.g.
    <period resource_id="1" start="2009.03.21 00.00.00" end="2009.09.21 00.00.00" style="defaultStyle"/>You'll see that the 'style="defaultStyle" ' attribute of the data corresponds to a segment of XML outlining what that style is e.g.
    <period_style name="defaultStyle">Now take a look at the Bar Style in Resource Project example in the AnyChart online documentation http://www.anychart.com/products/anygantt/docs/users-guide/bar-style.html#bar-style-application-resource-project. In that particular example, a number of different bar styles are used i.e.
    <periods>
      <period resource_id="server_1" start="2008.07.07" end="2008.07.8" style="Working" />
      <period resource_id="server_1" start="2008.07.8" end="2008.07.12" style="Maintance" />If you need to add a different bar style to particular rows of data on your chart, then you'll need to add new bar style XML for each colour you wish to use in the Custom XML on the Chart Attributes page, and then you'll also need to generate the data XML yourself, applying the necessary bar style to the relevant row of data. I've got an example of how custom data can be generated for a Resource Gantt here e.g. https://apex.oracle.com/pls/apex/f?p=36648:73 but keep in mind that particular example doesn't demo adding different styles to the data...but it can certainly give you an idea of what's entailed in the generation of custom data for your chart.
    I hope this helps.
    Regards,
    Hilary

Maybe you are looking for