Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shading Details for last 7 days

Status
Not open for further replies.

Dross

Programmer
Aug 16, 2001
212
0
0
US
I am using CR XI and have detail information by a date. I need to shade the previous days based on day 1, day2 etc.
So this week (days 3,2,1) would be nocolor, but the last week (days 7-1) would be silver. Then the week before that would be nocolor again. Any thoughts?

So this is what it looks like:
Week Day Date Data
3 3/24 55
2 3/23 456
1 3/22 747
7 3/21 562
6 3/20 232
5 3/19 652
4 3/18 323
3 3/17 854
2 3/16 457
1 3/15 235
 
In section expert click color

In formula box on background colour

If {datefield} = lastfullweek then crsilver else crwhite

Ian
 
Thanks Ian. That worked for the previous 7 days, but I need it to alternate from shaded to not shaded all year for alternating weeks. Does that make sense? So last week is shaded and the week before shouldn't, but the week before that should...
 
Try this instead

if remainder(datepart("ww", currentdate),2) <> 0 then
(If remainder(datepart("ww", {datefield}),2) <> 0 then crsilver else crwhite)
else
If remainder(datepart("ww", {datefield}),2) = 0 then crsilver else crwhite

Ian
 
That did it, thanks! You are tha man!
 
Now they want something added and maybe you can see how. I can't seem to get my head wrapped around this project (doesn't everyone love floating requirements?) now that I can shade every other week, they want to do a comparison of weekday to weekday. So this Monday VS last Monday, but every day to every day from the beginning of the year. Since there are no groups I am having a hard time making that happen. Any thoughts on that?
 
You can use a variable.

Split deatils into two sections, leave all your data in upper one and suppress lower one

@MondayComparison

whileprintingrecords;

global numbervar ThisMonday;
global numbervar LastMonday;

if dayofweek(datefield) = 2 then ThisMonday:= valuefield;

ThisMonday-LastMonday

In format field set suppression to
dayofweek(datefield) <> 2

Create similar formula for each day and place on top of each other in upper details section

Place this in lower detail section
@setvars

whileprintingrecords;
global numbervar LastMonday;
global numbervar LastTuesday;

etc

if dayofweek(datefield) = 2 then LastMonday:= valuefield;
if dayofweek(datefield) = 3 then LastTuesday:= valuefield;

etc

Ian






 
I only have 1 detail section. 1 row per day
 
Didn't really work as expected, but thatnks for the idea, I was coming at it a different way. I think I attached a pdf of what I am doing so that maybe you can see what I am working on
 
It should be comparing
3/21 - 1282 to 3/14 - 1451
3/20 - 1035 to 3/13 - 1141
etc
 
The data is correct

3/21 - 1282 to 3/14 - 1451
Difference is 169 which is what is showing against 3/14

Ian
 
I think it is the order I have the math in. the 169 should be at the 3/21 line, not the 3/14 line
 
Sorry did not spot the order. Doh!

YOu can only use vars as the data flows, you would have to reverse order of data to get difference to show against 3/21

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top