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:
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:
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:
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)
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:
That’s it!
As a result I got this:
Hope that helps,
Andreas
Great Webi trick !
You've been added to Webi 4.x tricks : summary for a better visibility. Keep posting !
William
Hi,
Nice trick,,but it is applied only for that column not in row,plz give your suggestion how i can do...
Hi, you have to add this Conditional Formatting to each Column.
then how to do..plz suggest
Coditional formatting only we have apply right?
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
thank you for your reponse,i got it,,
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.
Nice Idea.. Keep Posting.
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:
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 🙂
NICE TRICK 🙂 COOL ...HOPE YOU KEEP POSTING
Thanks for sharing.
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.
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:
2. I created the Conditional Formating below:
Result:
..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.
Thanks, Andreas. This is very helpful!
Thanks, Andreas. You Saved me.Please Keep posting