Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not picking up correct shift #
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Not picking up correct shift #
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01309538
Message ID:
01309538
Vues:
45
I am trying to correct a bug without finding the bug, by going to the end of a Program and then correcting the problem; this is only a temporary fix, until I can track down the bug which is a date problem. I end up with a date such as "04/08/-0" The DASH ZERO is okay, and is the shift the employee worked, but the missing 2-digit year is a major problem. I am about to go to San Antonio, Texas, next Wednesday to see my youngest son graduate from Air Force basic Training and cannot leave our production software in this sad state of affairs. I'm doing this test on non-live data on my workstation.

It seems that the Shift number never goes to the next record's correct shift number; whatever I start out with is what carries through in the REPLACE. I didn't use REPLACE ALL, because I am only wanting to correct the currently selected record that meets the filter condition.

Here's my fix it code:
CLOSE ALL
USE C:\PRODUCTION\DATA\PRODUCTION IN 0
*** 04/09/2008 Cecil Champenois. We suddenly had a problem with the 2-Digit Year
*** being missing in the Production.Date field. This is an effort to discover
*** the problem and fix it. This problem started with the date of 04/08/08-0.
*** This happened the following day with 04/09/08-0 turning into 04/09/-0.
SELECT Production
SET STEP ON
* Capture the current year.
LOCAL lcYear As Character, lcCurrentYear As Character
lcYear=ALLTRIM(STR(YEAR(DATE())))   && Get the 4-Digit Current Year.
lcCurrentYear=SUBSTR(lcYear,3,2)    && Get the 2-Digit current year.
* Let's see how many of these goofed up records we have.
COUNT FOR SUBSTR(Production.Date,7,1)="-"   && Example: "04/08/-0"
* If we have 1 or more, let's fix them now.
IF _TALLY > 0
   SET FILTER TO SUBSTR(Production.Date,7,1)="-"
   BROWSE
   GO TOP
   SCAN FOR SUBSTR(Production.Date,7,1)="-"
      lcDashShift=SUBSTR(Production.Date,7,2)
      REPLACE Production.Date ;
         WITH LEFT(Production.Date,6) + lcCurrentYear + lcDashShift ;
         FOR SUBSTR(Production.Date,7,1)="-"
         SET STEP ON
   ENDSCAN
ENDIF
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform