View Containing Only This Week's Data

Mindwatering Incorporated

Author: Tripp W Black

Created: 12/16/1999 at 06:06 PM

 

Category:
Notes Developer Tips
Formulas, Views

Note:
This tip has a "bad" selection criteria. Don't use this tip as it is for large databases. It will kill the NIF.

Just by looking at the code listed in the last post - it doesn't look like it will pick up docs from the previous month if the week overlaps two months. The following code is a little shorter and uses @Adjust to take into account the differences in the months.


d := @Weekday(@Now);
endday := @If(d = 7; 1; d = 6; 2; d = 5; 3; d = 4; 4; d = 3; 5; d = 2; 6; d = 1; 0; 8);
startday := @If(d = 7; -5; d = 6; -4; d = 5; -3; d = 4; -2; d = 3; -1; d = 2; 0; d = 1; 1; 8);

endDate := @Adjust(@Now; 0;0;endday;0;0;0);
startDate := @Adjust(@Now; 0;0;startday;0;0;0);

SELECT form = "form_name" & ((@Created >= startDate) & (@Created <= endDate))

previous page