Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simplify Case Structure - The Real Story
Message
From
27/12/2007 10:26:09
 
 
To
27/12/2007 10:22:36
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01277777
Message ID:
01277782
Views:
23
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform