Skip to Content
Author's profile photo Former Member

alternate row colors in a break

Some days ago I had the requirement to show alternate row colors in a break.

In fact that I was missing a SCN-Entry about this – there we go:

(I am using BO 4.0)

Requirement:

/wp-content/uploads/2013/11/req_320848.png

Solution:

1. I create a variable RunningSwitcher with following definition:

=RunningCount(LineNumber();([Project]))

This gives me a number starting at 1 for each line of one project:

/wp-content/uploads/2013/11/running_switcher_320974.png

2. next I created a variable ProjectSwitcher with following definition:

=If(LineNumber()=1;1;If([RunningSwitcher]<>1;Previous(Self);Previous(Self)+1)) 

This variable gives me the same number for each project starting by 1:

/wp-content/uploads/2013/11/switcher_color_320990.png

3. a variable which checks if the ProjectSwitcher is even or odd to get one number for each even row and another for each odd row:

=Mod([ProjectSwitcher];2) 

breakColor.png

4 & last step: I created a conditional formatting on the last variable which just set a gray background color if the row number is 0:

conditional.PNG

That’s it!

As a result I got this:

result.PNG

Hope that helps,

Andreas

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo William MARCY
      William MARCY

      Great Webi trick !

      You've been added to Webi 4.x tricks : summary for a better visibility. Keep posting !

      William

      Author's profile photo Ganapathy P
      Ganapathy P

      Hi,

      Nice trick,,but it is applied only for that column not in row,plz give your suggestion how i can do...Alternaterow.JPG

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi, you have to add this Conditional Formatting to each Column.

      Author's profile photo Ganapathy P
      Ganapathy P

      then how to do..plz suggest

      Coditional formatting only we have apply right?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Conditional Formatting = Alters in BO 4.x

      So just click on each column of your table and check the box for RowColor-alert.

      Hope that helps

      Author's profile photo Ganapathy P
      Ganapathy P

      thank you for your reponse,i got it,,

      Author's profile photo Former Member
      Former Member

      Hi Andreas,

      It's nice trick to get the alternate row color based on the dimension values.

      I had same issue and resolved by using below variables and wants to share

      Variable 1:

      Curr Value : =[Location]

      Variable 2:

      Prev Value: =If(IsNull(Previous([Location]));[Location];Previous([Location]))

      Variable 3: (to distinquish the dimension values alternatively)

      Alternate Color: =If([Curr Value]=[Prev Value];(0+Previous(Self));If((Previous(Self))=1;0;1))

      Applied Aleter on based on the Alternate Color variable and achieved the required result.

      Hope it is useful.

      Author's profile photo sampath guntha
      sampath guntha

      Nice Idea.. Keep Posting.

      Author's profile photo Neil Mitchell-Goodson
      Neil Mitchell-Goodson

      I am a fan of brevity and don't like to create lots of functions where I don't need to. Therefore I do something like this:

      =if(mod(runningcount([Project]) forall([Bidder];[Quote])+1;2)=0;1;0)

      Starting from the outside in, the runningcount should ignore the bidder and quote columns to just give us the same as step #2 above. We then add 1 to this and check (using the mod function) if this number is divisible by 2. If it is, it's an even row and we return a 0. If it's not, we return a 1. This will then give you an output the same as step#3, leaving you free to perform the conditional formatting via an alerter.

      Nice and concise 🙂

      Author's profile photo Former Member
      Former Member

      NICE TRICK 🙂 COOL ...HOPE YOU KEEP POSTING

      Author's profile photo Former Member
      Former Member

      Thanks for sharing.

      Author's profile photo Former Member
      Former Member

      This is nice feature indeed. I accomplished this functionality creating simple variable with formula:

      =Mod(RunningCount([Some dimension]) In Break;2)

      Afterwards used this variable in creating conditional formatting rule. Hope this helps.

      Author's profile photo Zahid Yener
      Zahid Yener

      Why don't you guys use Odd or Even formula for this problem.

      That's how i did it.

      1. I created the variable below:

      /wp-content/uploads/2015/09/pic_1_785110.png

      2. I created the Conditional Formating below:

      /wp-content/uploads/2015/09/pic_2_785129.png

      Result:

      /wp-content/uploads/2015/09/pic_3_785130.png

      Author's profile photo Neil Mitchell-Goodson
      Neil Mitchell-Goodson

      ..because sometimes you want to apply the formatting based on a particular dimension and not just a simple odd / even row number, as in the original post.

      Author's profile photo Former Member
      Former Member

      Thanks, Andreas.  This is very helpful!

      Author's profile photo vsenni senni
      vsenni senni

      Thanks, Andreas.  You Saved me.Please Keep posting