Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CASE permutations
Message
De
07/09/2007 23:10:10
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
07/09/2007 23:07:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01253160
Message ID:
01253166
Vues:
24
>>I'm sure there is a better way to handle the CASE for the two parameters in the code below. How can I make this block extensible so I can add other message and cursor types in the future without ending up with a spaghetti bowl of code?
>>
>>
>>	PROCEDURE GetCursor
>>
>>		PARAMETERS MessageType, CursorType
>>
>>		DODEFAULT()
>>
>>		DO CASE
>>			CASE m.MessageType = 'HL7' AND CursorType = "Demographics"
>>				* Do Something
>>			CASE m.MessageType = 'HL7' AND CursorType = "Scheduler"
>>				* Do Something
>>			CASE m.MessageType = 'EDI' AND CursorType = "Demographics"
>>				* Do Something
>>			CASE m.MessageType = 'EDI' AND CursorType = "Scheduler"
>>				* Do Something
>>		ENDCASE
>>
>>	ENDPROC
>>
>
>
>Really depends on what "* Do Something" is.
>
>This might be a tad simpler:
>
>
>PROCEDURE GetCursor
>  PARAMETERS MessageType, CursorType
>
>  DODEFAULT()
>
>  DO CASE
>    CASE m.MessageType = 'HL7'
>      DO CASE
>        CASE CursorType = "Demographics"
>	 * Do Something
>        CASE CursorType = "Scheduler"
>	 * Do Something
>      ENDCASE
>    CASE m.MessageType = 'EDI'
>      DO CASE
>        CASE CursorType = "Demographics"
>	 * Do Something
>        CASE CursorType = "Scheduler"
>	 * Do Something
>      ENDCASE
>  ENDCASE
>ENDPROC
>
>
>but not by much. The main thing that's going to simplify it is figuring out whats the same in each "* Do Something" and programing around that.

Interesting. Ok, each CASE will create cursors with different structures, then return the alias for that particular cursor to the calling program to be populated.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform