Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Efficient coding problem
Message
De
16/11/2000 01:01:38
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00442342
Message ID:
00442498
Vues:
15
>Hi everyone,
>
>I'm writting a statistics program and this is my problem: I want to create 3 sets of statistical calculated values: for source='S' field names should end on 'pur' - purchase, for source='M' 'ref' - refinance, and for no matter that source (eithier S or M) 'all'.
>
>Currently I didn't find a better solution, than create RunAll, RunPur and RunRef functions, which are almost identical except I use different appropriate field names and in two first cases where condition. Unfortunately, this makes my life very hard, if I want to change code. I have to make the same changes in all three functions.
>
>Do you have better ideas for me? I'd like to avoid macros if possible.
>

If S records only have pur fields, and M records only have ref fields, and they're otherwise the same, I'd refactor the database, so that there's a master record that indicates the type of source, and a child that has the fields without any prefix that carry the PKey of the master record. You end up with fewer fields, all the queries will use the same query, with only the source code varying, the data is smaller, new types can be added without altering the structure of the database, and if it's possible for more than one occurance of detail for a master record, there's a simple way to allow it without altering the tables or queries significantly. The reports are the same, except for a heading that you could pass as a variable. The result is that you call the same procedure three times with different parameters, rather than three distinct modules, uses less disk space, and is easier to maintain.

>Thanks in advance.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform