Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case Endcase
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00658264
Message ID:
00658332
Views:
21
>I have the following code. I am trying to delete records in a table. Depending on the day of week, the program needs to delete a certain calculation of the date on the PC.
>
USE ach_clears IN 0 ORDER clear_date EXCLUSIVE
	SELECT ach_clears
	DO CASE
		CASE = CDOW(DATE()) = 'Monday'
			DELETE ALL FOR clear_date > DATE() - 4
		CASE = CDOW(DATE()) = 'Tuesday'
			DELETE ALL FOR clear_date > DATE() - 4
		CASE = CDOW(DATE()) = 'Wednesday'
			DELETE ALL FOR clear_date > DATE() - 5
		CASE = CDOW(DATE()) = 'Thursday'
			DELETE ALL FOR clear_date > DATE() - 3
		CASE = CDOW(DATE()) = 'Friday'
			?CDOW(DATE())
			SELECT ach_clears
			DELETE ALL FOR clear_date > DATE() - 3
	ENDCASE
	USE IN ach_clears
so--- deletion-of-records occurs depending on field 'clear_date' value
if monday (if today is monday),
delete for 'clear_date' is recent friday and future
if tuesday,
delete for 'clear_date' is recent saturday and future
if wednesday,
delete for 'clear_date' is recent saturday and future
if thursday,
delete for 'clear_date' is recent tuesday and future
if friday,
Print "Friday" and delete for 'clear_date' is recent wednesday and future
--- that's what you are doing
Edgar L. Bolton, B.S. B.B.A.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform