Link to home
Start Free TrialLog in
Avatar of vbnetcoder

asked on

custom background color per row

I have a table that is connected to a dataset that will return 5 and only 5 items every time.  The background color for each row needs to be different so the first item will be red, the second will be orange, the third purple etc.

How do i do this?
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vbnetcoder


I ended up using a switch but the concept was the same
Can you post your Switch code?  Kinda curious.

And a screen shot of your report with all the colors.  I have occasional debates with other experts on how many colors should be used in a report, especially with those experts that have embraced the new metrosexual 'minimalist' look.

I can't post the report  because i would get in trouble with my client.  The table i was talking about earlier was a table HOWEVER i was using the table as a legend for a chart.  So, the first column was a square with the background using the switch statement and the second column was a description

I had to change to script a little so that i could share it but this gives the idea:

=SWITCH(RowNumber("dsTable1") = 1, "Green"),
RowNumber("dsTable1") =   2, "Blue"),
RowNumber("dsTable1") =  3, "Gray"),
RowNumber("dsTable1") =  4, "Green"),
RowNumber("dsTable1") =  5, "Red")
Ok thanks.
Looking at Jim's solution I think he meant to use Switch but typed IIF instead (IIF doesn't work like that) :)