Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacement for USE/SELE table with IF...ELSE...ENDIF
Message
De
02/10/2007 09:25:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
02/10/2007 09:02: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:
01257862
Message ID:
01257874
Vues:
13
>I know there is some way of putting this on one line using IIF (I think), but I just can't recall it right now. Thanks!
>
>
>IF !USED('Schedule')
>	USE Schedule IN 0
>ELSE
>	SELECT Schedule
>ENDIF
>
You might use a UDF. Here is mine:
FUNCTION SelectOrOpen(tcTableName, tcOrder, tcAlias, tnBuffering)
	* Abrir una tabla. Si ya estuviera abierto el alias, simplemente seleccionarlo.
	* Parámetros:
	* - tcTableName - la tabla que se quiere abrir
	* - tcOrder - el index tag que se ha de seleccionar
	* - tcAlias - con qué alias se quiere abrir la tabla
	* - tnBuffering - parámetro para buffering;
	*   normalmente igual a 5, 3, u omitido.
	if empty(tcAlias)
		tcAlias = tcTableName
	endif
	if used(tcAlias)
		select (tcAlias)
	else
		select 0
		use (tcTableName) alias (tcAlias) again
	endif
	if not empty(tcOrder)
		set order to (tcOrder)
	endif
	if VarType(tnBuffering) = "N"
		CursorSetProp("Buffering", tnBuffering)
	endif
ENDFUNC && SelectOrOpen
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform