Conditional Row Colors

Hello everyone,
I have a column in a table that can have 3 different values. I'd like the font on the row in the APEX Report to change based on the value. I have the following case statement:
CASE
WHEN "PRIORITY" = 1
THEN '<span style="color:red:'
|| 'font-weight:bold;font-size:14">'
|| "PRIORITY"
|| '</span>'
WHEN "PRIORITY" = 2
THEN '<span style="color:orange:'
|| 'font-weight:bold;font-size:14">'
|| "PRIORITY"
|| '</span>'
WHEN "PRIORITY" = 3
THEN '<span style="color:black:'
|| 'font-weight:bold;font-size:14">'
|| "PRIORITY"
|| '</span>'
ELSE "PRIORITY"
END
I'm getting the error "Columns that use HTML need alias names".
I've tried to add "PRIORITY as "Priority" above the case statement, in the main select statement, but then it gives me "ORA-00923: FROM keyword not found where expected".
I basically want the whole row to be colored based on the priority. The column name is supposed to be "Priority".
If anyone can help, or knows of a better way to do this, let me know!
Thanks,
Joe

Hi,
As long as you are not using the "Alternating Row Colors" report template, then there is an easier way. Go to Shared Components, Templates and click Create. Create a new Report template based on a copy of an existing template - perhaps the Standard report template. When created, click on the link for your new template to edit it. You will see four Column Template settings numbered 1, 2, 3 and 4. In the Column Template 1, you will see the currently defined template for each TD in a row. Copy this into the other three Column Template settings. Now, in the Condition settings for 1, 2 and 3, select "Use Based on PL/SQL Expression". In the Column Template 1 Expression, enter the following:
#PRIORITY# = 1Repeat that, using the correct PRIORITY values, for the Expression settings for 2 and 3. Leave Column Template 4's conditions empty (this makes it unconditional).
Now, in each Column Template, you can apply your style to the TD tag according to the condition you have set.
Finally, on your page's report, set it to use your new template.
Andy

Similar Messages

  • ALV rows coloring based on condition

    Hai ,
    I want Color the rows in the list based on some condition ..
    Hope to get the helpful suggestion s on this asap
    regards,

    Hi shishupalreddy,
    1. Not only the full row color,
      we can also manipulate the color in each cell,
      based upon conditions.
    2.
    IMPORTANT THINGS
    a. Extra field in internal table
    clr TYPE slis_t_specialcol_alv,
    (this field will contain the colour codes)
    b. assign fieldname to alv layout
    alvly-coltab_fieldname = 'CLR'
    c. work area for colour
    DATA : clrwa TYPE slis_specialcol_alv.
    d. Populating the color
    Once again
    Loop at ITAB.
    *********logic
    if itab-field < 0 "---negative
    clrwa-fieldname = 'FIELDNAME'. "<--- FIELDNAME FOR COLOR
    clrwa-color-col = 6. <------- COLOUR 0-9
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP.
    5. just copy paste in new program
    6.
    REPORT abc .
    NECESSARY / MUST
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    ITAB DECLARATION
    DATA : prg TYPE sy-repid.
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : clname(3) TYPE c,
    clr TYPE slis_t_specialcol_alv,
    END OF itab.
    DATA : clrwa TYPE slis_specialcol_alv.
    PARAMETERS : a TYPE c.
    DATA : flname TYPE slis_fieldname.
    SELECT
    START-OF-SELECTION.
    SELECT * FROM t001
    INTO CORRESPONDING FIELDS OF TABLE itab..
    LOOP AT itab..
    IF SY-TABIX <= 5.
    itab-clname = 'C50'.
    ELSE.
    itab-clname = 'C30'.
    ENDIF.
    MODIFY itab.
    ENDLOOP.
    LOOP AT ITAB.
    check itab-bukrs = '1000'
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 4.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    ENDLOOP.
    prg = sy-repid.
    flname = 'CLNAME'.
    alvly-info_fieldname = 'CLNAME'.
    alvly-coltab_fieldname = 'CLR'.
    LOOP AT ITAB.
    if sy-tabix = 3.
    clrwa-fieldname = 'BUTXT'.
    clrwa-color-col = 6.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    clrwa-fieldname = 'LAND1'.
    clrwa-color-col = 1.
    APPEND clrwa TO itab-clr.
    MODIFY ITAB.
    endif.
    ENDLOOP
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = prg
    i_internal_tabname = 'ITAB'
    i_inclname = prg
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    minimum
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2
    extra
    sy-uname = 'XYZAB'.
    prg = sy-repid.
    Excluding
    DATA : excl TYPE slis_t_extab.
    DATA : exclwa TYPE slis_extab.
    exclwa = '&OUP'.
    APPEND exclwa TO excl.
    exclwa = '&ODN'.
    APPEND exclwa TO excl.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid
    is_layout = alvly
    i_callback_user_command = 'ITAB_USER_COMMAND'
    it_excluding =
    excl
    i_save = 'A'
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    *& Form itab_user_command
    text
    -->WHATCOMM text
    -->WHATROW text
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    BREAK-POINT.
    ENDFORM. "itab_user_command
    regards,
    amit m.

  • Conditional alternating row colors

    Hello
    I have a report of companies an their country which is ordered by the column country. I'd like to have a alternating row color for every new country and not for every new row as it is in custom settings.
    Is that possible? How can I do that?
    Regards Felix
    Edited by: Felix on 21.09.2011 12:33

    Hi Scott
    sorry, I still not quite understand how to do, because which row must be colored depends on the number of countries in the database and alphabetic order of the countries.
    For example I show you only the country row of an example report and its row color as it should be right of it (because you cannot color text in this forum):
    [Country Row] [Row color]
    Albania light blue
    Albania light blue
    Albania light blue
    Albania light blue
    Andorra light green
    Andorra light green
    Andorra light green
    Andorra light green
    Argentina light blue
    Australia light green
    Australia light green
    Australia light green
    Once some data rows are inserted with a new country it should look like this
    [Country Row] [Row color]
    Albania light blue
    Albania light blue
    Albania light blue
    Albania light blue
    Algeria light green (new data)
    Algeria light green (new data)
    Algeria light green (new data)
    Andorra light blue (color switched)
    Andorra light blue (color switched)
    Andorra light blue (color switched)
    Andorra light blue (color switched)
    Argentina light green (color switched)
    Australia light blue (color switched)
    Australia light blue (color switched)
    Australia light blue (color switched)
    Now the row color of rows beneath Algeria changed (in order to keep the alternating row color alternating)
    I hope I now pointed out my problem more clearly.
    Thanks
    Felix

  • UIX - Changing read-only-table row colors

    Hi
    I have the requirement to alternate the background-row-color in an UIX read-only-table dependent on a value in the row.
    Can anybody point me in the right direction of a solution please?
    I'm familiar enough with the styles in the XSS style sheets, and using EL to dynamically change attributes of a UIX web page when rendered. However in the default <table> UIX tag generated by JDeveloper when dragging a data control onto a UIX web page, there doesn't appear to be a <row> tag for changing the background colour?
    Any help appreciated
    I'm using JDeveloper 9.0.5.2.
    Cheers,
    CM.

    I don't know if this works in JDeveloper 9.0.5.2, but there's a solution at least for JDevloper 10.1.2. You have to define a different styleClass (a CSS) for each column, depending on a condition. This solutions works as well together with row banding:
    <column>
      <columnHeader>
        <sortableHeader model="${ctrl:createSortableHeaderModel(bindings.MyView,'Seats')}" text="Seats"/>
      </columnHeader>
      <contents>
        <rowLayout width="100%" styleClass="${ui:cond(uix.current.IsLocked == 'J', 'OraTableCellLocked', '')}">
          <contents>
            <cellFormat>
              <contents>
                <textInput model="${ui:defaulting(uix.current.Seats, ' ')}" columns="10" readOnly="true"/>
              </contents>
            </cellFormat>
          </contents>
        </rowLayout>
      </contents>
    </column>The styleClass "OraTableCellLocked" has to be defined in the file "base-desktop.xss". An example ("Locked" cells are displayed with a red background):
       <style selector=".OraTableCellLocked">
        <includeStyle name="TableCellDataText"/>
        <includeStyle name="TableCellDataVerticalAlign"/>
        <!--<includeStyle name="TableCellDataBackgroundColor"/>-->
        <includeStyle name="TableCellDataBorderColor"/>
        <property name="background-color">#FFA4A4</property>
      </style>Hope this helps, although the original is very old.
    Regards,
    Georg

  • Dynamically changing row color in an ADF table?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please let me know the code for dynamically changing the row color of an ADF table?
    Thanks,
    Vik

    well you can use EL on af:column inlineStyle property to change the color on condition
    e.g
    inlineStyle='#{(row.SelectedRow)?"background-color: Silver":""};a example can be found here it is changing color based on Checkbox selection http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html

  • Table row colors alternating

    Hello Everyone,
    I'm trying in the configure properties of a table change the row colors to alternating, but it has no effect.
    It always remains the same formating, i.e., every row with the same blue color.
    I only can set it to alternating if the table is marked in the properties as editable (Editing condition = true). It doesn't make any sense! I do not want the user to change the cells of the table, but still want to use alternating colors, and it is not possible.
    I'm using Visual Composer 7.01 with SP5
    Does anyone have any idea?
    Tanks,
    Diogo Ferreira.

    Hi,
    For messages about VC 7.0 version (this includes 7.01 and 7.02) please refer to the [VC 7.0 forum|SAP NetWeaver Visual Composer;.
    Best regards,
    Tal.

  • Change the row colors based on column values in MOSS 2007.

    Hi Team,
    I am using MOSS 2007 environment. In that I am having one SharePoint list. In that list based on column values rows colors need to change.
    Kindly help me anyone on this.
    Thanks,
    Ashok

    Hi Ashok,
    Please follow the below link:
    http://www.contentmaster.com/sharepoint-2010/conditional-formatting-of-list-views-for-sharepoint-2010-changing-the-font-colour/
    http://sharepoint.stackexchange.com/questions/7478/highlight-row-color-based-on-field-values-in-sharepoint-2010-list-view
    Best Regards,
    Brij K

  • Alternting row color on HEADERS

    I cannot figure out how to alternate the row color on the header columns. Personally I find it annoying if the header column is all the same color, but the table rows alternate. I find it hard to follow across the columns since I have several columns set at headers. I tried manually setting the row color, but on a sort, the colored rows are all jumbled and don't match the alternating rows on the data.

    Hi k,
    The short answer is that it can't be done.
    The longer one is that it can, but the process is tedious.
    The three images below are of the same table. The table was sorted and renamed to indicate that sort, and screen shots of the first two sorts pasted into the document before grabbing the image of all three states.
    Row 1 is a header row, and does not enter into the sort.
    Column A is a header column. When the table is formatted for alternate row colours the colours apply only to the Standard cells (columns B and C of the initial table (plus the added columns D and E).
    The cells in column A require a Conditional Formatting rule to change their fill colour to match the alternate row colour under a specific condition. One of the conditions available is that the text in the cell matches the text in another specific cell.
    The cells in columns D and E are used to set up that condition. The In the final table, D and E may be hidden.
    The formula in D is:   =MOD(ROW(),2)
    As can be seen, this places a 0 in 'even' rows and a 1 in 'odd rows.
    The formula in E is:   =IF(D>0,A,"")
    For 'odd' rows, where D contains a 1, this copies the contents of the cell on the same row in column A into column E. For 'even' rows it places the empty string into column E.
    Both formulas are filled down through all standard rows of columns D and E.
    Note that the two formulas can be combined into one:   =IF(MOD(ROW(),2>0,A,"")
    Idf the single formula is used, the steps below assume it is entered in E2 and filled down the rest of column E.
    You will need one column 'E' for each header column you want to format, with the formula in each adjusted to pick up the contents of column A, B, C, etc.
    Now comes the tedious part. The Conditional Formatting rules compare the contents of the cell to a fixed value or to the contents of a specific other cell. Unlike formulas, they to not self-adjust if we use Fill Down.
    But we can save a few steps by choosing the conditional fill colour for all cells at once, then editing the reference cell for each individually.
    • Select all of the cells in column A (and the other header columns to which you want to apply conditional formatting).
    • Open the Cell Format Inspector and click Show Rules...
    • In the dialogue that opens, use the popup to choose "Text is"
    • Click the icon at the right end of the box that appears, then click cell E2 (the first non-header cell in column E) on the table.
    • Click Edit.
    • Click the Fill color well that appears, then choose the conditional fill colour to match the alternate row colour. (Hint: Use a colour from the color palette—easier to match)
    • Click Done to confirm the choices.
    •Click away from the selected cells to release the selection, then click on A3 to select just that cell.
    Repeat the following until you're through the column.
    • Click on the E2 reference in the box beside "Text is" to select it.
    • On the table, click on the cell to be referenced (it will be the one below the cell indicated by a blue outline). The E2 reference in the rule will change to the new cell.
    • Press return to confirm the new selection.
    • Press return again to move down to the next cell.
    Repeat.
    It works, but it certainly ain't elegant!
    You might also consider going to the Application menu (in Numbers, the "Numbers" menu), choosing Provide Numbers Feedback, and making a request that the alternating row colour feature be enhanced to apply to alternate row in a header column as well as to standard cells. Be prepared to wait, though, at least until the next full version of Numbers is released.
    Regards,
    Barry

  • Sysdate Year Row Color

    Hello All,
    I need help adding row color to an entire row. The link below is great but my task is a little different. I need help modifiying the 'BI Publisher Properties' to only make the Condition based on the sysdate 'year' not the entire sysdate. I need to compare field Warranty (12/22/2010) 'year' to the sysdate 'year' (06/28/2010). Does anyone know how to add this logic to to my template? Thanks for reading this Thread.
    http://winrichman.blogspot.com/search/label/formattingMy Conditional Format looks like this. I am not clear on how to get the year from each value for the statement.
    <?if:xdoxslt:Warranty('yyyy')=xdoxslt:sysdate('yyyy')?><?attribute@incontext:color;'red'?><?end if?>

    Here's the link to the guide: http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187.pdf
    Also check page 7-69 in there to see how to use the condition for a row (@row context).
    Also, look at this: http://winrichman.blogspot.com/search/label/row%20color
    Alternately, you could use the substring function to just derive the year part and then perform the comparison.
    <?if@row:substring(warranty,n,n)= substring(sysdate,n,n)?><?attribute@incontext:color;'red'?><?end if?> -- substitute appropriate values for n.
    Thanks!
    Edited by: BIPuser on Jun 28, 2010 9:49 AM

  • Can we put condition for color in bex query designer

    hi all,
    can any one guide me how to put a condition for color settings in query designer
    for example:
    i have a key figure like ANSWERED%.in analyser it should display in red if  answered% exceeds 95%.
    please help me in this issue.
    regards
    Vamshi D Krishna.

    Hi,
    Use Exceptions while designing your Query.
    Please go through the link
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/21b4cd14cd06f4e10000000a422035/frameset.htm

  • SSRS 2012 Conditional Formatting Color Issues When Exporting to Excel

    Hi all,
    We recently upgraded to SQL 2012 from SQL2008 R2. I'm having a strange issue with SSRS2012.
    One of the report has conditional formattings on cell background colors. Everything works fine when render the report in browser or preview mode. However, the conditional formatting stop working when export the report to Excel (no issues if
    export to pdf). All cells are high-lightened with pre-defined color although it should only high-lighten those cells that fulfil the condition.
    Has someone encountered this issue before ? Thanks for any help.

    Hi ZZ02,
    I have test the scenario in my testing environment, however, everything goes well when exporting to Excel format. The issue might be related to the expression for the conditional background color. To make further analysis, please post the expression as well
    as the report design structure.
    Additionally, in SQL Server 2012 Reporting Services, the Excel rendering extension renders a report to the native format of Microsoft Excel 2007-2010, the format of which is ExcelOpenXML. By default, the previous version of the Excel rendering extension,
    compatible with Microsoft Excel 2003, is disabled. At this time, I suggest that you enable the Excel 2003 rendering extension by modifying the RSReportServer.config file. After that, the Excel 2003 rendering format will be available on report manager (not
    available in Report Designer). So, please export the report from report manager and check the result again.
    For more information about enable the Excel 2003 rendering extension, please see:
    http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/0713de27-dcc0-4e51-81ac-5272647d171f
    Regards,
    Mike Yin
    TechNet Subscriber Support
    If you are
    TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here. 
    Mike Yin
    TechNet Community Support

  • Want robust solution for alternating row color, resetting every group

    I would like a solution for displaying an alternating row color for my detail rows that resets every group, so that row 1 is always gray.
    Our Crystal designer provided this code to me:
    @rowcnt formula, suppressed, placed in Detail row:
    Shared numbervar rowcnt;
    rowcnt := rowcnt + 1;
    @resetrowcnt, suppressed, placed in Group row:
    Shared numbervar rowcnt;
    rowcnt := 0;
    Formatting formula, placed in Color in Detail > Section Expert:
    Shared numbervar rowcnt;
    if Remainder(rowcnt, 2) <> 0 then
    color(241,241,241)
    else
    crWhite
    This was working fine for me.
    However, it is suddenly not working in one of my reports.
    The report does happen to have two groups (rowcount.png).
    When the report is run, all rows are colored (rowcount02.png).
    This report was previously working fine!  I'm not sure what changed.
    In any case... surely there must be standard code to do this very standard formatting.
    I would be very grateful if someone could post some robust code to accomplish the following:
    REPORT DATA IN DETAIL ROW, ALTERNATE ROW BANDING:
    - Data in Detail row displays alternating row colors
    - Odd rows are always shaded, even rows not
    - Banding resets every group / does not continue pattern from previous group
    REPORT DATA IN GROUP ROW, ALTERNATE ROW BANDING:
    Some of our reports place row data in a group row (just the way it happened).
    If you could also modify your code in this case.
    Thank you!

    Hi Abhilash/Sastry, since I'm going to switch to Sastry's formulas, could you please confirm correctness of the following. I can't actually run this report, I can only provide it to our London office, bit of a lag for testing.
    @resetrowcnt:
    Whileprintingrecords;
    Numbervar cnt:=0;
    @rowcnt:
    Whileprintingrecords;
    if {HedgeDetails.StrategyID} <> previous({HedgeDetails.StrategyID}) and
    {HedgeDetails.DealID} <> previous({HedgeDetails.DealID}) then
         Numbervar cnt:=cnt+1;
    Details section (Suppress):
    not(OnFirstRecord) and
    {HedgeDetails.StrategyID}=previous({HedgeDetails.StrategyID}) and
    {HedgeDetails.DealID}=previous({HedgeDetails.DealID})
    Please note: Suppress checkbox is selected AND the above formula is entered.
    Details section (Color):
    Whileprintingrecords;
    Numbervar cnt;
    if cnt mod 2 <> 0 Then color(241,241,241) else crwhite

  • Report Template - Standard, Alternating Row Colors

    I'm using APEX 4.1.0 and theme 22 on Oracle 10g.
    I have some tabular forms in my application. For 2 of those, row deletions are allowed and I have the usual select box column to manage the row deletions. Also my users like the "Standard, Alternating Row Colors" report template and would like to see the alternating row colors whenever possible. Unfortunately I get the "Error on page." browser error in IE when I check a row selector box using this template. When I use a different report template I don't get this error.
    The tabular form functions correctly so this error is harmless, but I would like to know what it is for. I'm sure my users would rather not see that error.
    By the way, in Firefox the firebug error count increases and I get the following error in the console:
    TypeError: can't convert undefined to object
    [Break On This Error]      
    ...ovedColor)}gLastRowMoved=b}function html_RowUp(e,d){var c=$x_UpTill(e,"TR");ie_R...
    apex_4_1.min.js (line 18)Because all of the whitespace has been helpfully removed :) it's hard to see which expression is undefined and why.
    Any ideas?

    Hi Jackie,
    There must be some issues the apex_4_1.min.js file, try to reload it. In apex.oracle.com the tabular form with "Standard, Alternating Row Colors" just works fine.
    Regards,
    Natarajan

  • Change JTable's row color on row selection

    Hello!
    Everywhere I've looked they're only explaining how to draw rows in different colors WHEN THE TABLE IS BEING CREATED, via prepareRenderer.
    But that is not what I am looking for. What I want is to actually change the row's color after the table has been drawn/rendered/whatsoever. For instance, when the user clicks on that row. The default behaviour is for the row to become blueish, but, when the user selects another row, the first selected row turns back to white. I would like to prevent that from happening. I want the row to become FIRE RED when the user clicks on it, and I want the row to remain like that for good, even when the user selects a different row. Do I make any sense here? :-)
    Thank you for your time and future suggestions.

    Everywhere I've lookedApparently you didn't look in the Swing forum, because thats where Swing related questions should be posted.
    but how do I assign a cell renderer to an entire row/table ?The easiest way is to use the prepareRenderer(...) method you have already found. My "TablePrepareRenderer" class (which you can find by searching the Swing forum) shows you how to do this.
    You will note that the color of the row is determined by data in the table. So all you need to do is add another column in the TableModel that contains the information you need to determine the row color. That column can be removed from view in the table by removing the TableColumn from the TableColumnModel.

  • Alternating row color for CF report Builder?

    I have a user who wants one of her reports to display
    alternating row colors for better read clarity. The reports are
    rather lengthy and the rows tend to blend in with eachother.

    Thanks Epulfy. I am going to give this a try later today.
    Much appreciated
    EDIT:: This does work. however I'm not sure how to set a
    rectangle to the background of the report so it's behind my
    details. I draw the rectangle and it just hides whatever I want to
    display. When I look at the report it does alternate with rows, but
    I can only see details from the rows that it does not alternate on.
    Any clue how to set it to the background?

Maybe you are looking for