Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simplify Case Structure - The Real Story
Message
De
27/12/2007 10:26:09
 
 
À
27/12/2007 10:22:36
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01277777
Message ID:
01277782
Vues:
22
>Reposted because obviously I didn't explain it correctly in the other thread and it is getting bogged-down with stuff that's not relevant...
>
>Looking for a way to extend this to be able to handle any number of diagnosis codes. Currently we use 4, but that could change. I don't want to have to change the code every time we change that. Any ideas? Thanks!
>
>
>* Value of .Field003 changes with each loop
>FOR x = 1 to Whatever
>	DO CASE
>		* 1st Diagnosis Code
>		CASE VAL(.Field001) = 1
>			m.Diag1 = LEFT(ALLTRIM(UPPER(.Field003)),AT('^',.Field003)-1)
>		* 2nd Diagnosis Code
>		CASE VAL(.Field001) = 2
>			m.Diag2 = LEFT(ALLTRIM(UPPER(.Field003)),AT('^',.Field003)-1)
>		* 3rd Diagnosis Code
>		CASE VAL(.Field001) = 3
>			m.Diag3 = LEFT(ALLTRIM(UPPER(.Field003)),AT('^',.Field003)-1)
>		* 4th Diagnosis Code
>		CASE VAL(.Field001) = 4
>			m.Diag4 = LEFT(ALLTRIM(UPPER(.Field003)),AT('^',.Field003)-1)
>	ENDCASE
>ENDFOR
>
local Diag[ max you can think of ]

Diag[VAL(.Field001)] = LEFT(ALLTRIM(UPPER(.Field003)),AT('^',.Field003)-1)
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform