Conditional formatting of a table using RowNumber()

4 posts, 0 answers
  1. Christophe
    Christophe avatar
    4 posts
    Member since:
    Mar 2013

    Posted 05 Sep 2013 Link to this post

    I would like to have every second row with a different style in my table.
    I have created the following conditional formatting rules for the two different styles:

    Expression: =RowNumber() % 2
    Operator: =
    Value: 1

    Expression: =RowNumber() % 2
    Operator: =
    Value: 0

    The issue is that the values are grouped by the field of the first column, and the RowNumber() function restarts to 1 for each new country value (see the attached screenshot).
  2. Nasko
    Admin
    Nasko avatar
    1051 posts

    Posted 06 Sep 2013 Link to this post

    Hi Christophe,

    The RowNumber() function can take a scope as argument, so if you want to count the number of rows over the whole crosstab, you should use the following expression in the conditional formatting:

    =RowNumber("crosstab_name") % 2

    where crosstab_name is the name of the current crosstab.

    Otherwise when using just RowNumber() you are counting the number of rows in the current data-context (defined by the crosstab groupings).

    Regards,
    Nasko
    Telerik

    Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

  3. Rory
    Rory avatar
    3 posts
    Member since:
    Nov 2015

    Posted 05 Aug in reply to Nasko Link to this post

    An how exactly do we figure out the "crosstab_name"? I'm not seeing that anywhere. 

     

    I've created a table with multiple rows in the template and the rownumber() is always 1.

  4. Rory
    Rory avatar
    3 posts
    Member since:
    Nov 2015

    Posted 05 Aug in reply to Nasko Link to this post

    Nevermind, I got it working, by passing the Telerik.Reporting.Table's name so in my case I used 

    = RowNumber("table2")%2 

    for the Expression

Back to Top