Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case Endcase
Message
From
18/05/2002 19:26:28
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00658264
Message ID:
00658626
Views:
19
>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.

Two additional suggestions:

  • Use the HTML code < PRE > to make program code more readable - this will respect spaces, etc.
  • cdow(date()) = "Monday" isn't trustworthy - I would get "Lunes" ("Monday" in Spanish) on some machines. Checking for the numeric value of dow() is safer.

    Hilmar.

    >
    >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
    >
    >It seems that none of these conditions are true and nothing gets deleted. Am I thinking wrong?
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform