Different take on conditional formats - parameterizing the color?

Hi - I'm trying to do conditional formatting, but all the examples & help I've found shows a sample that hardcodes the actual color used. I have a requirement where I need to pass in the color in as part of my XML input.
The logic used to determine what color to display a number is very complex, and has changed a couple of times already. As such, I'm trying to keep all that logic in a SQL view, rather than reproducing the logic a hundred times over in the XSLT of a handful of reports.
My datamodel is set up something like this:
<PROC>
   <APPN>APA</APPN>
   <REQUEST>10,000</REQUEST>
   <SAC>9,500</SAC>
   <SAC_COLOR>red</SAC>
   <HAC>10,000</HAC>
   <HAC_COLOR>black</HAC_COLOR>
</PROC>
<PROC>
   <APPN>MSLS</APPN>
   <REQUEST>12,000</REQUEST>
   <SAC>12,500</SAC>
   <SAC_COLOR>green</SAC>
   <HAC>10,000</HAC>
   <HAC_COLOR>black</HAC_COLOR>
</PROC>
. . . This bit of XML would generate two rows in a report, with the first row having the "SAC" value colored red, the second row having "SAC" as green.
So I've tried using something like:
   <?for-each:PROC?>
      <?APPN?>
      <?attribute@incontext:color;SAC_COLOR?><?SAC?>
      <?attribute@incontext:color;HAC_COLOR?><?HAC?>
   <?end for-each?>But that throws errors when it tries to parse it. I've tried a number of different formats of this, as well as the lower-level format:
   <?for-each:PROC?>
         <?APPN?>
         <xsl:attribute name="color"><?SAC_COLOR?></xsl:attribute><?SAC?>
         <xsl:attribute name="color"><?HAC_COLOR?></xsl:attribute><?HAC?>
   <?end for-each?>but haven't had any luck finding something that works.
I know I could put in a set of if statements or a choose block, but again, that'd mean reproducing the same logic many many times over.... maintenance nightmare.
Any ideas?
Thanks in advance,
-- Andy

Got closer to an answer, I think. Tried using an XSL variable, and rewrote the logic as below. I used the xsl:attribute because it allowed me to specify the color as the content of an XML tag, rather than an attribute..
<?for-each:PROC?>
   <?xdoxslt:set_variable($_XDOCTX, ‘colSac’, SAC_COLOR)?>
   <?APPN?>
   <xsl:attribute name=”color”><?xdoxslt:get_variable($_XDOCTX, ‘colSac’)?></xsl:attribute><?SAC?>
<?end for-each?>and this almost works - I get the correct value from my data substituted in for the get_variable, but the xsl:attribute open/close is rendered as text. So my output for the SAC field ends up reading:
<xsl:attribute name=”color”>red</xsl:attribute>9,500So I guess I'm using the xsl:attribute tag incorrectly? I've googled that, have found a few examples that show the same sort of notation... am I missing something obvious here?
Edited by: Tanjental on Jul 16, 2012 8:22 AM

Similar Messages

  • I hired a commercial artist to create a color image for the cover of a self published book. I want a black and white image for the inside. The commercial artist has not responded to this request. How do I determine the format of the color image, I'm guess

    I hired a commercial artist to create a color image for the cover of a self published book. I want a black and white image for the inside. The commercial artist has not responded to this request. How do I determine the format of the color image, I'm guessing it's Illustrator's formatting but I don't know. How can I find out if Illustrator will open the file and allow alterations? The image opens only in Apple's Pages software?

    rons,
    It seems that all you have is a raster image, presumable PNG24 or JPEG, in RGB.
    It may have been created as raster artwork in Photoshop, or it may have been created as vector artwork with the help of Illy, or as a mixture of vector and raster artwork in either application, or both combined.
    If you just need to have a raster representation in black and white based on the current colour image, you may try this, in a new RGB document (View>Smart Guides are your friends):
    1) File>Place the image (you may tick Link or untick and have it embedded);
    2) Create a rectangle with black fill (R = G = B = 0), at least as large as the image, and place it behind the image (you may ClickDrag with the Rectangle Tool between opposite corners, then Ctrl/Cmd+X+B);
    3) Select all and in the Transparnecy palette flyout click Make Opacity Mask with both Clip and Invert Mask ticked.

  • Conditional formating if the cell contains any date

    Hi,
    In my excel sheet i have one column containing only date (US format) or else they are blank. I want to format the cells containing date to Red color. How do i do it
    Please help

    If you mean the font colour, just format the cells to have red font.
    So I guess you mean interior colour.
    You haven't said which version of Excel - it always helps.
    For Excel 2003, for example, select the cells then
    Format > Conditional Formatting > Cell Value Is > Greater Than: 0 > Format > Patterns > Red
    For Excel 2007 or 2010, Home > Conditional Formatting > Highlight Cells Rules  > Greater Than > 0 with Light red fill
    Bill Manville. Excel MVP, Oxford, England. www.manville.org.uk

  • Conditional Formatting - Bold the smallest value.

    I have a row of cells with time in them. How can I make the cell with the lowest value - bold?
    thanks.

    As an example,
    If column B is a list of dates&times and cell C2 = MIN(B)
    then the format for all the cells in column B is
    "if equal to 'cell C2' then Bold"
    Whoops, sorry, you said row, not column. Same idea, though.
    If row 2 is a list of dates&times and cell B3=MIN(2:2)
    then the format for the cells in row 2 is
    "if equal to 'cell B3' then Bold"
    Note that there is no "time", it is date and time. If today you enter "2:00" and tomorrow you enter "1:00", the 2:00 is the earlier time. This is because it is tagged with the date you entered it, unless you specify a different date. If this will be a problem for you, you will have to create a separate row that strips the date off of it with =TIMEVALUE(2:2). This will allow you to get the minimum. I'll have to take a few minutes to figure out how to do the rest.
    Message was edited by: Badunit

  • Conditional formatting in the chart  does not work after 10g to 11g upgrade

    W e have upgraded from 10g to 11.1.1.6.8 recently. For all the reports conditional formatting for charts is not working for us which used to work in 10g.
    While researching , i have found that advanced xml needs to be modified. So i changed xml where there is 'untypedLiteral' to 'decimal' and saved the report. Inspite of saving , xml wouldnt change . It still shows as untypedLiteral.
    I also tried to delete the conditional format and recreate again. But still it wouldn't work.
    Please advise.

    W e have upgraded from 10g to 11.1.1.6.8 recently. For all the reports conditional formatting for charts is not working for us which used to work in 10g.
    While researching , i have found that advanced xml needs to be modified. So i changed xml where there is 'untypedLiteral' to 'decimal' and saved the report. Inspite of saving , xml wouldnt change . It still shows as untypedLiteral.
    I also tried to delete the conditional format and recreate again. But still it wouldn't work.
    Please advise.

  • Copying formatting from conditional formatting without the rules

    I tend to use a lot of conditional formatting in my spreadsheets. Unfortunately, this leads to two problems:
         1) I need more rules than are allowed (this seems to be related to the height of my screen... probably because the dialog box doesn't have a scrollbar)
         2) This really, really slows things down, especially when combined with cell references, and particularly when I'm trying to rearrange cells (as far as I can see Numbers has a tendency to freeze and/or blank out the table I'm working on)
    The easiest way I can see out of my predicament would be to somehow remove the conditional formatting rules while keeping the actual formatting... like copy-and-pasting values instead of the actual cells (with intact formulae). Is this possible? And if possible, how would I go about doing it?
    Thanks in advance!

    Up to 15 rules can be set for conditional formating of a cell.
    1)
    Considering that the usual purpose of conditional formatting is to flag 'unusual' values, and to make the 'condition' instantly visible and recognizable, that seems an over generous number. If a cell or group of cells on your table 'needs' more than 15 possible formats (the base format and 15 others based on rules), perhaps what's needed is a re-thinking of why that many are needed, and whether having that many formats adequately answers that 'why'.
    If you really do need that many, you can set then, even if your display height is filled with fewer than that. Additional rules may be inserted after any existing rule, not just the last one. note, though, that the conditions are evaluated in the order the rules are listed, from top to bottom, and the format is set by the first rule encountered whose condition is met.
    2)
    Not surprising. Numbers recalculates the entire table each time a value in the table is changed. That calculation includes through each list of conditional formatting rules until a match is found (or the end of the list is reached), and includes setting the new format for each affected cell.
    3)
    Not that I'm aware of. The base format of the cell may be copied (option-command-C) and pasted elsewhere (option-command-V), and that pair of operations will include any conditional format rules that had been set for the original cell.
    But conditional formatting is just that—a set of rules that applies a set of attributes to a cell when a specific condition is met. The applied format exists only when the condition is met, and can't be copied except by copying the rule—actually the whole set of rules for that cell—which puts you no further ahead.
    3a) You could, of course, change the base format of the cell to match the colour and style applied by the conditional rule, then clear the conditional format rules for that cell or set of cells. That would 'remove the rules while keeping the (applied) formatting', and would leave the formulas intact. seems to me a game not worth the candle, though.
    Regards,
    Barry

  • How to do relative pasting of conditional formatting?

    -I have a table with 5 columns and 220 rows.
    -I have a conditional format set up in the first row. The fill color of col 2-5 changes based on col 1 value.
    It seems I can't paste the first row's conditional formatting to the other 219 rows without having to go back and edit each row's condition to point to it's own first column.
    What am I doing wrong??? It's like the pasting of the conditional formatting isn't doing relative pasting of the condition.
    Thanks!

    Andrew Stewart4 wrote:
    Hi twangy-
    I am trying achieve what you seem to have accomplished. i.e. changing the colour of a cell/s based on another cell. How did you do this?
    Hi Andy,
    I suspect twangy hasn't told us the whole story here, as the conditional formatting of a particular cell cannot depend solely on the contents of another cell.
    What it can depend on is the value in that other cell compared to the value in the cell to be formatted.
    To apply this colour change to a group of cells often requires the use of an auxiliary cell whose purpose is to take on a value whereby the same condition will be either TRUE compared to all cells in the set or FALSE compared to all cells in the set.
    The easiest comparison to use for this purpose is 'greater than' or 'less than' as all that's required for the auxiliary cell is to set its value to something just outside the range if values included in the set of cells to format.
    Example 1: I have a row of four cells (B2, C2, D2 and E2), and I want them all to turn red if the sum of the values they contain exceeds the value in another cell (G2).
    It can't be done directly, but I can set up an auxiliary cell (H2) with an IF statement to create a value that is greater than the value in any of the cells to be formatted when the sum of their values is greater than G2 or a second value which is less than the value in any of the four cells when their sum is less than or equal to the value in G2.
    I can then set the same rule for all four cells: (Apply the format when 'my' value is) Less than   H2
    Formula for H2 in this case:
    =IF(SUM(B2:E2)>G2,MAX(B2:E2)+1,MIN(B2:E2)-1)
    Example 2: If the value in any of the four cells exceeds the value in G2, apply the formatting to all the cells.
    As previous example, but formula for H2 is now:
    =IF(OR(B2>G2,C2>G2,D2>G2,E2>G2),MAX(B2:E2)+1,MIN(B2:E2)-1)
    Note that the two possible values of H2 are the same in both formulas. All that differs is the comparison with cell G2 that determines which value H2 will have.
    Regards,
    Barry

  • IDisk and conditional formatting

    I've been using conditional formatting to add color to cells for specific events. It's great and allows me to assess data at a glance. Recently, I decided it would be nice to have this data available to me on my iPhone, through iDisk. However, when I copy the file over, open it up on the iPhone, no conditional formatting is apparent.
    Is this just a no-go?
    I realize I can do 1 of two things to fix it: 1) apply the color manually (not a valid choice, really) or 2) save it as a PDF, which retains the color.
    Why I would like to keep it in Numbers is because I really like the tabs for different pages at the top on the iPhone screen. Loading the file as a PDF it seems rather laggy, since it loads all the pages on the same screen.
    Thanks in advance.

    Hi,
    you may use guided navigation to drill to a custom request.
    In the request which has the time level prior to day in time hierarchy, click on 'add navigation' button and select the request which has the day level.
    Build a request with day and sales columns. Edit the formula for sales measure and put for example: case when day = 'monday' then null else sales end.
    Regards,
    Monica Bocchio

  • Conditional formatting / "Text is" applied to multiple values?

    Hello there,
    Is there a way of making the "Text is" rule to apply to different values?
    Example:
    Text is: apples, oranges
    Return text color red
    I keep asking myself if it's all synthax problem from my side… Should I use commas, apostrophes, etc.?
    Thanks!

    Mariana,
    you can use a shader table and one other table to facilitate grouping words into the the same (or multiple) color(s). 
    In this image there are three tables.  The top left table contains your data.  In column A I entered some words.
    In the second table (top right, and named "WordList") I entered a single entry for each word and what color I wanted the corresponding shading to be.  These are just words which I will match with conditional formatting.
    The third table is the "shader" table.  In this table I apply the conditional formatting as shown.  Once the shader table is complete you can use the menu item "Arrange > Send to Back" then slide the table under the top left table.
    The formula you can use in the shader table is (be sure you use the same table names):
    A1=IFERROR(VLOOKUP(Data :: A1, WordList :: A:B, 2, 0), "")
    now select A1 and fill down as needed.
    You can enter words and colors as needed in the "WordList" table

  • Sharepoint Foundation 2013 - Conditional formatting

    Hey all,
    I'm trying to pull of conditional formatting for the outcome of a "Yes or No" column within a Custom List, however all the searching I have done shows that it seems to have been removed in Sharepoint 2013 without using a Jquery (I'm having problems
    getting my head around Sharepoint 2013 at the moment, dont want to add Jqueries to it as well lol).
    Have I missed something stupidly easy? I have http://www.cdpdev.com/Blog/Post/7/Conditional-Formatting-in-SharePoint-2013 but it seems to be using Sharepoint
    2013 with Sharepoint designer 2010 which I dont really want to have to do as the will be in time handed over the my 'manager' who will self manage and using 2 different pieces of software is kinda out of the question.
    Regards
    JB

    Hey @ITechbrij
    it seems the above post doesn't work for Sharepoint 2013 as I'm getting a syntax error but this maybe due to me not being able to find the formula box so put it into the "Column Validate" section as I'm missing the formula box that is shown in the 2010 screenshots.
    If this is not possible what do you suggest? Going with the Sharepoint designer 2010 approach? As I cant find how to do it in 2013 and wouldn't know where the start with a jquery lol.
    JB

  • Conditional Formatting with multiple characteristics in report designer

    Hi,
    I'm trying to build a report with images in conditional formatting for two characteristics (=columns). Each of which can have one of the following three status values:
    1 - green
    2 - yellow
    3 - red
    For each status value i want to show a different image (traffic light). It works fine with only one characteristic. The conditional formatting creates three details rows in the row pattern (one for each status value) and depending on the status value the corresponding details row with the traffic light is shown.
    But if there is more than one characteristic with conditional formatting in the report it only works with a different row for each characteristic value, as the two characteristics belong to different group levels of the row pattern. That means I finally have 2 rows showing the two status values.
    To show them all in one row, which is the goal, I have  put all the conditional formatting definitions (6=3 for each characteristic) into the detail rows of the row pattern.
    But then for one characteristic incorrect images are shown, e.g. although the status value is red, a green traffic light is displayed, because the status value of the other characteristic is green.
    Obviously the conditional formatting only works with the characteristic, for which the details rows in the row pattern have been created.
    Any ideas how I can manage to show all the conditional images in one row?
    Thanks in advance.
    Regards,
    Sven

    Sven,
    your scenario is not supported yet.
    Right now, a conditional format is based on one condition.
    In the future it is planned to allow more conditions to be applied to the rowpattern, using "AND, OR" operators.
    The availability of the feature will be announced via the BI Functional Enhancement List (see BIFAQ)
    regards, karim

  • In need of assistance using checkbox and conditional formats

    Hello,
    I'm trying to set up a command to meet the following:
    When I opt to use a checkbox format in say cell "G2" - I would like to setup a conditional format along the lines of...
    =IF G2 is TRUE (i.e. checked), then change the color of cell "A2" to some color.
    Can anyone help me with the line command for this?

    L.
    Seems like it should be easy, doesn't it? There are options to doing this, but none are exactly obvious. The problem for you is that conditional formatting is based on the content of the cell being formatted, not some other cell. A typical use is to, say, bold content over a certain limit, or make the display of a zero value invisible.
    In Numbers08, you have only a couple of options:
    Use an IF-test to alter your content, or use an overlay table or tables. The solution you pick will depend on whether the content was calculated or input directly. If the content was input from the keyboard, that's the most difficult situation since there is no equation to modify.
    So, do you want to change the color of the Text, or the Fill, of cell A2? And, how important is this formatting to you? If it involves extra columns or tables and a lot of fussing around, do you still think you need it?
    Jerry

  • Is there any way to use a formula or reference in conditional formatting

    I would like to use conditional formatting (or something similar) to change either the background color, or text color, of a cell. The conditional formatting in the inspector will allow you to do this using numbers or text as the condition.
    Is there any way to do the same thing using either a formula or cell reference? I have created a budget with two sheets, "Budget" and "Actual". Each sheet has two tables, "Income" and Expenses." In the "Actual :: Expenses" table I would like to be able to change the cell color depending on the difference between the Actual and the Budget corresponding cells.
    I know I can do this by making a new column "Difference" write the formula and enter conditional formatting for that particular cell, but I DON'T WANT TO!!
    Just for fun, is there any way to roll over a cell and have a info box "pop up" that could show me what the difference between the two corresponding cells is. Kind of similar to how when you roll the mouse pointer over a file the box expands to show you the entire name of the file. Not to optimistic about this one.
    Thanks

    PeterVogelpohl wrote:
    Is there any way to do the same thing using either a formula or cell reference?
    Yes, Peter. Purchase iWork 09. Numbers 09 offers conditional format vs. content of another cell.
    Jerry

  • Conditional Formatting of a Direct Database Request Columns in OBIEE 11g

    Hi All,
    I need to do the conditional formatting like changing the
    column color based of some condition, but i can do to the conditional
    formatting in the normal answers in the column properties. But i want to do
    it in the rows of Direct Database Request.
    When i check the Column properties conditinal format is disabled.
    Regards
    Shanker

    Hi Shanker,
    It is a limitation, You cannot use conditional formatting in Direct Database Request
    Regards,
    Dpka

  • Conditional Formatting in one cell with a dates in another cell

    I have a simple spreadsheet that will gauge a project's progress.  I wish to have individual cells change color based on another cell.  I can't get the right syntax in order - groan
    E2 has today's date, =NOW()
    G2 (not started) would change from a color to no color when the start date, F27,  has arrived then
    H2 (started) would change to a color when the date is met, F27, (may be change color as the completed date arrives) then no color when the completed date arrives, F28.
    I2 (completed) would change to a color when the date is met, F28
    When the spread sheet is opened or if I need to change the dates in either of the cells the cells with color gauges will update.
    I am using conditional formating through the ribbon.
    Please help!

    Hi,
    Thank you for posting in the MSDN Forum.
    Since the issue is more relate to the end-user, I'd like to move it to Excel IT pro forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Best regards
    Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • PM Order, cost and key figures

    I have created and configured a new PM planning plant, cost center, work center, pm types and all that usual of PM requirement, but still I think something is missing in in the ingredient because when I try to creat a PM order and assign a bunch of o

  • IMac doesn't recognize input devices after going to asleep, must reboot

    Quite often, my iMac doesn't respond when I attempt to "wake" it using keyboard or mouse. The only way to wake the iMac is to tap the power button. However, when it wakes the mouse cursor is a spinning color wheel and the system does not recognize an

  • How i can obtain the authorizations settings suing SDK or SQL??

    Hi all, There is some way to obtain the "standard settings for authorizations" for every user in B1 using SDK or SQL on the database company. I know that is possible to add and recover the "additional authorizations", but i need to generate the repor

  • Photo shop Element 6 failed to open catalog  The catalog could not be opened.  It is either corrupt

    Photo shop Element 6 failed to open catalog  The catalog could not be opened.  It is either corrupt, or the version is out of date and cannot ne updated

  • Setting Margins for report

    Hi i have report that prints from a TAG-Printer (small receipt printer). every time i set its paper size (2.5'-1.5' ---selected from List) before printing it i want to hardcode its paper size and when i press button from form it don't ask any thing a