Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set and Get appl obj property good practice
Message
De
31/07/2009 10:19:24
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01415630
Message ID:
01415654
Vues:
61
> So I am going with array since I have never used collections before and even though it seems pretty straight forward from VFP help, I will refrain from starting now.

Why not use a collection ? If it's a keyed collection, think of it as an array where the index is a string

It's well worth investing a bit of time
	#define METHATABLENAME_INDEXES	[IndexTable]
	#define METHATABLENAME_PEOPLE	[PeopleTable]
	
	obj = createobject('Collection')
	
	obj.Add('\data\indextable.dbf', METHATABLENAME_INDEXES)
	obj.Add('\data\peopletable.dbf', METHATABLENAME_PEOPLE)
	
	
	&& get an item
	
	theIndex = obj.GetKey(METHATABLENAME_PEOPLE)
	
	if( empty(m.theIndex))
		&& is not there
	else
	
		? obj.Item(m.theIndex)
	endif
	
	
	&& or
	
	try
		theData = obj[METHATABLENAME_PEOPLE]
		?theData  
	catch
		&& 	&& is not there
	
	endtry
	 
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform