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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formula blank when no records

Status
Not open for further replies.

src2

Technical User
Mar 1, 2001
72
0
0
US
I'm running a daily report to show filtered records that were closed on the previous workday. The report works except when there aren't any records to be displayed. When that happens the @targetdate field is blank and doesn't showup on my Page Header. Any ideas?


Thanks
 
What is the content of your formula {@targetdate}?

-LB
 
@targetdate formula is as follows:

//Before processing - What date records do we want to keep
WhileReadingRecords;
//Define Holiday Array containing dates
//Define Target date as the current date.
//Define 2 number variables Add and Added used to cycle within the array
DateVar Array Holidays;
DateVar Target:= currentdate - 2;
NumberVar Add:= -1;
NumberVar Added:=0;
// As long as Added is greater than Add cycle through the array
While Added > Add
// Set the date we're looking for to the previous day.
// each cycle will go back one day until the target date is a workday and not a holiday
Do (target:=target-1;
// Was the target date a workday and not a holiday?
if dayofweek(target) in 2 to 6 and not (target in holidays)
//the target date was a workday and it isn't a holiday so subtract 1 from Added to exit the loop
then Added:= Added-1
//the target date was either a non-workday or it was a holiday so we want to keep searching
//by keeping added at 0 so we don't exit the loop
else Added:=Added);
//Read records that have the target date
Target
 
Try leaving out "whilereadingrecords;".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top