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

Similar Messages

  • 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?

  • Alternating Row Colors - Interactive Report

    Hello All,
    I'm hoping someone out there can help me out w/this. :)
    I'm a newbie working w/an Interactive Report and want to have alternating row colors as a default w/out losing the IR advantages.
    I've tried javascript, but, whenever filters are applied the class gets stripped off.
    Has anyone had any luck w/this?
    Thanks In Advance

    Roel,
    I got it working... Adding the onload to the image is pretty awesome, I had to chuckle cause I would've never thought of that.
    It wasn't working for me earlier, but, i realized after it was a silly syntax error. :P
    Anywho - Check the link below.
    http://apex.oracle.com/pls/otn/f?p=17445:7::::::
    I had used a different striping script which was written by a buddy of mine Keith Daulton (Had to throw him props for a hawt script. Works in ie6/7, FF, Chrome & Safari).
    I'm 100% sure I'm not the only one who's wanted this done and struggled to get it. So below I'm providing it for those who run into this thread.
    <script type="text/javascript">
    // THIS DOES THE STRIPING
    function decorateDataGrids (strClass) {
         var tables = document.getElementsByTagName("table");
         for (var i=tables.length; i--;) {
              if (tables.className == strClass) {
                   var gridRows = tables[i].getElementsByTagName("tr");
                   for (var j=gridRows.length; j--;) { if (j%2) { gridRows[j].className = "even"; } }
    window.onload = function () {
         decorateDataGrids("apexir_WORKSHEET_DATA"); // THIS DOES THE STRIPING
    </script>
    <style>
    /* THIS OVERRIDES APEX'S DEFAULT STYLES */
    table.apexir_WORKSHEET_DATA tr.even td {
         background-color:#F1F5FA !important;
    table.apexir_WORKSHEET_DATA td {
         background-color:#FFFFFF !important;
         border:1px solid #B3B3A7 !important;
         padding:4px 8px !important;
    </style>
    onload event strapped to the img -- Thanks!!!
    <img src="#IMAGE_PREFIX#edit.gif" alt="" onload="decorateDataGrids('apexir_WORKSHEET_DATA');">
    Edited by: user11086646 on Jun 9, 2009 7:04 PM

  • 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

  • DataGrid alternating row colors per column

    Is there a way to set different alternating colors to each
    column in a DataGrid. I have a datagrid where I want two of the
    columns to have different alternating row colors, one column (red
    and light red) and the other (green and light green).
    Many thanks

    You can simply set the DataGridColumn property to the
    approprate colors.
    ex.
    <mx:DataGrid y="0" x="0" width="100%">
    <mx:columns>
    <mx:DataGridColumn id="col1" backgroundColor="0x640000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0xFF0000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x006600"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x33CC33"
    dataField="col1"/>
    </mx:columns>
    </mx:DataGrid>
    or you can use the setStyle:
    col1.setStyle("backgroudColor", 0x640000)

  • Alternating row color

    I have a spreadsheet and the alternating row color only works down to a certain row. I can't copy the style, etc. Tried turning it off and then back on and that doesn't work. Also when I copy a cell from a blue row to a white row it retains the blue color for that cell on the white row. Any ideas?
    Thanks.

    Select all the rows that are not showing the alternating colour fill and go back to the inspector and set colour fill to NONE. Don't select the header column, if any, as the colour fill will be removed from that too. The copy and paste including the colour is normal behaviour, you can use Edit > paste values instead
    Have a good day.

  • Alternating row color is missing a row

    Hi,
    I've made a table and have checked the "alternating row color" box.  It's working fine except for the top row, which should be colored in and isn't.
    Any suggestions on how to fix this?
    thanks.

    Is the top row a header row? That may prevent it from being the intended colour. If so, remove the header setting and reapply the alternating row colour.

  • 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

  • Apex 4 -- Standard, Alternating Row Colors row highlight broken

    template: 14. Standard, Alternating Row Colors in apex 4.0 appears to have it mouse-over row highlight colors reversed (except for the first row, which is not highlighted)
    when first displayed, the rows are displayed white/gray/white...
    mousing over the first row does nothing, mousing out does nothing
    mousing over the 2nd row does nothing, mouse out changes it to white
    mousing over the 3rd row does nothing, mouse out changes it to gray
    etc

    I noticed this behavior too, very annoying. Did someone found a way to fix the template ?

  • How Get Alternating Row Colors To Work?

    I've searched this forum, searched online, and followed the directions in the Numbers 3.0 Help, but I just can't get the Alternating Row Colors function to work.  I'm using an iMac and a new Mac Mini, both running Mavericks, on a spreadsheet converted from Numbers '08.  I've seen several screenshots of tables in discussions on this forum that seem to have Alternate Row shading; presumably they were done with Numbers 3.0. So apparently, it can be done.  Need Help!

    Vistan wrote:
    Now I see it!  I did not have any of the Table Style boxes in the upper right cortner of the creen selected...when I choose one, the alternate row colors sudenly pop up.  I'm now experimenting with the Grid Lines and Header &Footer selection buttons.
    Vistan
    Vistan,
    I'm about as sure as I can be that Table Style boxes having being clicked has nothing to do with the Checkbox for Alternating color rows. I've been wrong before, but I can't grasp the logic on this one, and it doesn't happen here the way you describe.
    Jerry

  • Alternating row colors. How to?

    All,
    When I use the Report Wizard, I can get alternating row colors. How can I get the same effect, when I use the 'create report using my sql query' option?
    thanks
    sanjay

    Sanjay,
    It is the same way that you do in it wizard reports, specify the table row colors in the display options section for gettng alternating row colors.
    Thanks and Regards
    Balaji

  • Interactive report default has alternating row colors, how to remove this?

    Is it possible to remove the alternating row colors from the interactive report.
    In a standard report I can select the report template, but in a interactive report not.
    Regards,
    Rob

    To customize a single page, add this rule to the CSS Inline page attribute:
    .apexir_WORKSHEET_DATA tr.odd td {
      background: rgb(242, 242, 242) !important;
    To apply to a complete application, either add
    .apexir_WORKSHEET_DATA tr.odd td {
      background: rgb(242, 242, 242) !important;
    to the Cascading Style Sheet Inline attribute on each page template, or create a CSS file containing
    .apexir_WORKSHEET_DATA tr.odd td {
      background: rgb(242, 242, 242);
    upload it to your workspace, and reference it after the theme link in each page template Header:
    <link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_4/css/theme_4_0.css" type="text/css" />
    <link rel="stylesheet" href="#WORKSPACE_IMAGES#theme_4_0_no_alt_row.css" type="text/css" />

  • Duplicating the "Standard, Alternating Rows Colors" report template

    The built-in theme 5 comes with a report template called "Standard, Alternating Rows Colors". This theme's template type is defined as "Generic Columns". I need to create a duplicate of this report template that has a template type of "Named Columns" instead of "Generic Columns".
    I've tried to create a brand new report template using the "Named Columns" template type and then copy/paste the appropriate HTML code from the original to the new one. Obviously there are some options in the "Generic Columns" template type that are not in the "Named Columns" template type, and vice versa, but I copied over what I thought was appropriate.
    No matter what I do, I don't seem to come close to having my copy look like the original. I've looked over the Report Template section of the User Guide, but that hasn't helped. Any suggestions on how to accomplish what I'm trying to do?

    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

  • Different content for a row popin in every row

    HI,
    is it possible to have a different content for a row popin in every different row?
    For example: In Row 1 I have a ViewContainerUIElement containing View A, in Row 2 I have a ViewContainerUIElement containing View B...
    This is what I need, different views in every row...
    Is this somehow possible?
    Best regards,
    Peter

    OK than. Have you think about one view which will be in your table popin, but each element in this view will be created dynamically? Than you will get the look as there are different views, different design for each row, but it will be the same view.

  • HTML Table with alternative row color, Using SQL XML

    Hi,
    I want to send out an email and the email body contains a table with data. I am using SQL to create the HTML table and to populate values inside the table. Below is the code I have so far
    DECLARE
    @HTML NVARCHAR(MAX)
    IF (SELECT
    COUNT(*)
    from Employee])
    != 0
    Begin
    SET
    @HTML =
    '<html><style>
          tr:nth-of-type(even) {
          background-color:#ccc;
    </style><body><h1 style="font-family:Tahoma; font-size:12px;">Hi,</h1>'
    +
    'Below is the report'+
    '<br></br>'+
    '<table border="1" width="100%" style="border:1px solid #77bfe4;font-family:Tahoma; font-weight:normal; font-size:12px;" cellpadding="4" cellspacing="0">'
    +
    '<tr bgcolor="yellow" style="font-family:Tahoma; font-weight:bold; font-size:12px;"><td colspan="2"><center>Report</center></td></tr>'+
    '<tr bgcolor="Blue" style="font-family:Tahoma; font-weight:bold; font-size:12px;"><td><center>Col1</center></td><td><center>col2</center></td></tr>'
    +
    CAST((
    Select
    td =
    col1, '',
    td
    = col2
    , '' from
    (Select ID as col1, Emp as Col2
    from
    Employee) E
    FOR XML
    PATH('tr'),
    TYPE
    AS NVARCHAR(MAX))
    + '</table><br>Thank you</br></body></html>'
    END
    select
    ISNULL(@HTML,'NoEmail')
    But I am having trouble generating alternative colors for each row (tr:nth-of-type(odd) is not working for me)
    Below is what the table should look like 
    Please help.
    Thank you for your help in advance. 

    Thank you for the response, I got the code to work.
    DECLARE @HTML NVARCHAR(MAX) ;
    IF (SELECT COUNT(*) from Employee]) != 0
    Begin
    SET @HTML = '<h1 style="font-family:Tahoma; font-size:12px;">Hi,</h1>' +
    'Below is the report'+
    '<br></br>'+
    '<table border="1" width="100%" style="border:1px solid #77bfe4;font-family:Tahoma; font-weight:normal; font-size:12px;" cellpadding="4" cellspacing="0">' +
    '<tr bgcolor="yellow" style="font-family:Tahoma; font-weight:bold; font-size:12px;"><td colspan="2"><center>Report</center></td></tr>'+
    '<tr bgcolor="Blue" style="font-family:Tahoma; font-weight:bold; font-size:12px;"><td><center>Col1</center></td><td><center>col2</center></td></tr>' +
    CAST(( SELECT CASE when (ROW_NUMBER() over (Order by Col1 DESC))%2 = 0 then '#E0E0E0' else 'white' END as "@bgcolor", '',
    td = col1, '',
    td = col2 , '' from
    (Select ID as col1, Emp as Col2
    from Employee) E
           FOR XML PATH('tr'), TYPE
    ) AS NVARCHAR(MAX)) + '</table><br>Thank you</br></body></html>'
    END
    select ISNULL(@HTML,'NoEmail')

Maybe you are looking for

  • NF980-G65 and 1075T

    I have a NF980-G65 with a 1075T I can get it to get into the bios but thats about it... I tried the MSI Forum HQ USB flashing tool however when I try to start it from the flash drive it just shows blank. Graphics card 470 MSI Geforce, G-skillet ram 4

  • Summary report treats a currency fields as text

    In the summary report I have three charts with the currency field. The two charts show 'average' and 'total' but the other chart shows 'percentage' of responses - in other words the report treats that field not as a number but as text. The filed is d

  • Safari 4.0.4 update creates 7510 new permissions problems

    Prior to installing Safari update, running the 'Repair Permissions' in Disk Utility found only one error -- the SUID modification on ARDAgent (Apple Remote Desktop Agent). Apple documents this as being a known issue, but harmless and can be safely ig

  • XI post installation help!!!

    Dear SAP gurus, I have installed XI3.0 successfuly and could perform post installation steps successfully. When i went through the document of readyness check of XI here i need to run T-code sproxy in order to check 1-) =>Check/maintain with report S

  • Website Design for Beginners

    Looking for a good wysiwyg software program for a 15 year old for hobbie purposes. Any thoughts on how Dreamwever stacks up against Expession Web? Web Design in Seattle