Link to home
Start Free TrialLog in
Avatar of Dee
DeeFlag for United States of America

asked on

Move a zillion :o hard coded variables and conditions to read from a table

I have inherited a VFP5 program to maintain that is full of exception conditions with hard coded values.  

For starters, lcAbbrev (Practice Abbreviation) has nearly 200 exception conditions throughout the program:

One example of many:
do case
        case inlist(lcAbbrev,"HMT","FRY","CMU","HMP","WEB","BCV")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and pmstype = "Company"
        case inlist(lcAbbrev,"VVH")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and inlist(pmstype, "Company", "Class")
        case inlist(lcAbbrev,"S24")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and inlist(pmstype, "Credit")       
        case inlist(lcAbbrev,"NWT","FPW","SUF","RCY","MCA","ACO","TOM","CRD","ACA","KNL","GIS")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and pmstype = "Type"
        case inlist(lcAbbrev,"ACT")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and pmstype = "Referral"                     
        case inlist(lcAbbrev,"UPV")
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and inlist(pmstype, "Company","ActionCode", "Class")
        otherwise
              APPEND from ("source\" + lcDir + ".clientattributes.csv") type delim for install <> "InstallationId" and pmstype = "Class"
  endcase

The entirety of these conditons are all hilighted on the included code in a Word doc.  

These exceptions need to be, somehow I think, read in from a table.  I quickly discovered how complex of a tangled mess I am faced with.    

Question:
Is trying to make this table driven the way to go?  If so, how would you proceed? Or otherwise?

The program is currently written in VFP5.  Eventually it will be moved to Java and MySql.  I think the monster needs to be tamed beforehand..

Thanks


_loop-j-pracabbr.docx
ASKER CERTIFIED SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dee

ASKER

Thank you both for your very thorough and helpful responses.  I was getting ready to dive into this code belly first!  After reading your responses, I'm not sure why I even considered it.    Whew.