How to change the background color of a cell based on other cell background

Hi,
Sorry if this is a basic question - I am new to XML. I want to create a table column, with no data in it. I then want to change the background color of the column based on the background color of other columns. I.E.
- If there are 3 or less cells in this row that are not green, color this cell green.
- If there are 4 or less cells in this row that are not green, and 3 or less are not red, color this cell yellow.
- If there are 4 or less cells in this row that are not green, and 3 or more are red, color this cell red.
If there are 5 or more cells in this row that are not green, color this cell red.
Many thanks for any assistance.

Okay - I have this resolved.
1. Create two variables (Yellow and Red):
<?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
<?xdoxslt:set_variable($_XDOCTX, 'Red', 0)
2. For each cell, set the background based on their individual traffic light criteria, and update the associated color variable by 1. By default the backgrd color is set to Yellow so I only have to check for the lower and upper bounds:
<?choose:?>
<?when:number(CHECKED_IN)<=1?>
<?attribute@incontext:background-color;'Lime'?>
<?end when?>
<?when:number(CHECKED_IN)>3?>
<?attribute@incontext:background-color;'Red'?>
<?xdoxslt:set_variable($_XDOCTX, 'Red', xdoxslt:get_variable($_XDOCTX, 'Red') +1)?>
<?end when?>
<?otherwise?>
<?xdoxslt:set_variable($_XDOCTX, 'Yellow', xdoxslt:get_variable($_XDOCTX, 'Yellow') +1 )?>
<?end otherwise?>
<?end choose
3. I now want a cell that is Red if any of the cells in the row is red. Its yellow of there are 3 or more yellow cells in the row, and no reds. Otherwise its green. First, create an empty cell and make the default color green. Then add:
<?if: number(xdoxslt:get_variable($_XDOCTX,'Red')) > 0?>
<?attribute@incontext:background-color;'Red'?>
<?end if?>
<?if: number(xdoxslt:get_variable($_XDOCTX,'Yellow')) >= 3 and number(xdoxslt:get_variable($_XDOCTX,'Red')) = 0?>
<?attribute@incontext:background-color;'Yellow'?>
<?end if?>
4. Finally, reset the variables for the next row:
<?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
<?xdoxslt:set_variable($_XDOCTX, 'Red', 0)

Similar Messages

  • 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

  • How to change the background color of a single row

    Hi OTN,
    I am using JDeveloper 11.1.1.2 with ADF faces in view layer.My issue is How to change the background color of a single row in af:table ?.

    How to highlight ADF table row based on column value?
    Found by searching

  • How to change the background color of a desktop??

    any ideas how to change the background color of a desktop?? Now the default color is blue. I couldn't fine the API in JDesktopPane on doing that..
    JDesktopPane desktop = new JDesktopPane(); //(textArea);

    Try the method setBackground. For me it's work.

  • Hi, I'm working on a document in PAges 09. Any idea on how to change the document color? I want it black instead of white.

    Hi, I'm working on a document in PAges 09. Any idea on how to change the document color? I want it black instead of white.

    Nichelle,
    You must add your own background object, and then make it Black.
    Insert > Shape > Rectangle
    In the Wrap Inspector, set to Floating.
    In the Graphic Inspector, set Stroke to None and set Fill to Black.
    Grab the corners of the document and stretch the document to cover the entire page.
    Back in the Wrap Inspector select "In Background".
    Format > Advanced > Move Object to Section Master.
    Regards,
    Jerry

  • How to change the default color of the selected row

    hi all,
    I need to know how to change the default color(yellow) of the selected row in a table component.whether i need to change anything in the stylesheet.If so, where should i make the changes in the stylesheet.
    thanks and regards,
    rpk

    The chart colors are being referred to *'palette.cxml'* file in these directories
    BI_HOME\web\app\res\s_oracle10\chartsupport
    BI_HOME\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\chartsupport
    you can change to your custom colors.
    Restart OC4J and PS to make the new ones work..
    Regards,
    Raghu

  • How to change the semantic color of entire rows in a table.

    Hi, in the past I already managed to change the semantic color of a cell by a condition (for example all the cells with negative number -> I set negative semantic color)
    My question is how can I change the semantic color of the entire row where this cell belong, and not only the cell. Im using NW2004.
    BTW, Im not a java programmer, neither a Webdynpro expert, just an ABAP Programmer. So try to be very explicit, Thx.

    Rodrigo,
    You can just bind correspondign property of every cell editor (TextView) of every column to the very same context attribute. Next, when you change attribute value for certain elemnt, the whole row (every cell editor in row) will get same value.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • How do change the text color in the variable screen ?

    Hi Experts ,
    I would like to know about , How do change the text color in the variable screen ?
    Using web templates (Analytical) can get the output. It has the variable screen contains 6 fields (Company code, Country , Region , COB, Plant and Purchasing Group). I want to make RED color text on Plant. Please help me .
    Thank you ,
    Prasad.

    Hi,
    I am looking for nearly the same. What I have found is that it seems to manipulate the SAP theme that is used in standard when template is executed in the portal. Just display the source code of the HTML and there you will see the included SAP theme (normally SAP_TRADESHOW). Then you have to go to the SAP portal and change this stuff. But for that you have to know where to find it and what impact this change has.
    I am not pretty sure if this is the right way. But as I want to change the standard layout of a whole template to a customer specific layout I think there is no other way in BI7.0.
    Regards,
    Peter

  • I just want to know that how to change the font color, font size, and forgr

    i just want to know that how to change the font color, font size, and forground color in JTextPane for the Selected text. i try diffrerent menthod like setFont and setColor, these methods change the fonts of the whole textpane. so please reply me as soon as possible, and thanks in advance.
    Moazzam

    Sell the Old one... Buy a New one...

  • Win10 blurry fonts/programs | How to change the accent color?

    Hi,
    Recently I installed Win10 Build 9926 on a virtual machine for testing and feedback and I am havin' some problems...
    First, I changed the Display settings to 125% and now the third-party Win32 classic apps are looking blurry... [Sorry, i can't provide a image link]
    Second: The Personalization "pane" (Sorry, long time mac user) only has options for the lock screen and now I dont know how to change the accent color...
    And this, I can keep with it, but I made a registry tweak to enable the start screen but now when I use it the taskbar is still there!!! ANNOYING!
    Any help will be appreciated...
    Thx,
    Tiago

    Hi,
    I made a test in our testing enviroment, found that when this problem occures,
    Sign Out current user and login again would be helpful to resolve this problem. Please take this method as a workaround temporarilly.
    Second question, to modify backgound color, you can access system personalize to modify the color:
    Roger Lu
    TechNet Community Support

  • How to change the document color mode(RGB to CMYK)?

    Kindly advice me how to change the document color mode(RGB to CMYK) via scripting in "illustrator cs3".
    Thanks.

    Somebody wrote and posted this a couple of years ago.
    // Duplicate the selection from the active document into a new document.
    // To invoke the JavaScript debugger, remove comment delimiters
    //$.level = 1; debugger;
    var newItem;
    var docSelected = app.activeDocument.selection;
    if ( docSelected.length > 0 ) {
    // Create a new document and move the selected items to it.
    var newDoc = app.documents.add();
    if ( docSelected.length > 0 ) {
    for ( i = 0; i < docSelected.length; i++ ) {
    docSelected[i].selected = false;
    newItem = docSelected[i].duplicate( newDoc,
    ElementPlacement.PLACEATEND );
    else {
    docSelected.selected = false;
    newItem = docSelected.parent.duplicate( newDoc,
    ElementPlacement.PLACEATEND );
    else {
    alert( "Please select one or more art objects" );
    It should give some ideas about how to proceed.

  • How to change the background color of a sequence?

    I'm using Premiere Pro CS5 on Win7 x64.  I've imported a JPEG that's a different size than my 1920 x 1080 frame.  The background of this JPEG is white, but the background of the sequence is black (by default), so the borders of the JPEG make it stand out.  I want the JPEG to blend into the sequence background by making the sequence background white.  How can I change the sequence background color?  Thanks.

    Jim and Ann are correct. I can see where someone used to After Effects might ask that question though because in AE you can change the background color of the composition. Same with Photoshop.
    However, I think it would confuse things if changing the background color were to be allowed in Premiere Pro. Black tells me something. I suppose white could tell me the same thing, but at this time it is not possible in Premiere Pro.

  • How to change the background color of a cell in datagrid using flex3

    i want to change the background color of a cell.....how can i achieve this.....and also i want to know how a spacing cane be done between cells in a datagrid...plzzz help me???

    The only way I can see to do this is to use an item renderer for your cells.  This is really scruffy and would need tyding up, and maybe with a little more time could do better or someone else may have an idea but none the less this works.
    Define a custom component as below;
    This has logic to see what the value of the data is proveided by the dataprovider for the row, and if it matches the conditions in this case is equal to 5 sets the background color.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="88" height="26" dataChange="doColor()" borderColor="#000000" borderStyle="solid"
        backgroundAlpha="1">
        <mx:Script>
            <![CDATA[
                private function doColor():void {
                    if (data.value == 5) {
                        setStyle('backgroundColor', 0xcccccc);
                    } else {
                        setStyle('backgroundColor', 0xffffff);
            ]]>
        </mx:Script>
    </mx:Canvas>
    Now just apply the item renderer in the datagrid and that will do it.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  xmlns:ns1="*">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                private var ac:ArrayCollection = new ArrayCollection([
                    {value : 1},
                    {value : 2},
                    {value : 3},
                    {value : 4},
                    {value : 5},
                    {value : 6},
                    {value : 7},
                    {value : 8},
                    {value : 9},
                    {value : 10}
          ]]>
        </mx:Script>
        <mx:DataGrid x="40" y="36" width="408" height="193" dataProvider="{ac}">
            <mx:columns>
                <mx:DataGridColumn headerText="Column 1" dataField="value" itemRenderer="MyComp"/>
                <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
                <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    I hope this helps
    Andrew

  • How to change the background color only for one HTML-Portlet?

    Hi all,
    I have created a HTML-Portlet in my root-page. The root page have a style: Main-Style.
    I want to change the background-color only for this one HTML-Portlet:
    <html>
    <header><title>Test</title></header>
    <body bgcolor="#999999">
    Test
    </body>
    </html>
    But this does not work...
    When I use the CSS, then it will change the background-color for the root-page too.
    Thans
    Leonid Pavlov

    could you try this
    <table bgcolor="#999999">
    <tr>
    <td>
    test
    </td>
    </tr>
    </table>
    I don't think you need <html><header><title>Test</title></header>
    <body></body></html> for your HTML-Portlet.

  • How to change the Background color of a cell in JTable

    hi!
    Actually i want to change the background color of few cells in JTable
    is there any method to make this change in JTable ?
    and also is it possible to have 5 rows with single column and 5 rows with 3 columns in a single JTable

    i want to change the background color of few cells in JTableDepending on your requirements for the coloring of cells it may be easier to override the prepareRenderer() method of JTable:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=610474

Maybe you are looking for