*--------------------------------------------------------------------- * EmptyObject(fieldsList) * Receives a list of fields separated by comma * Returns an empty object with empty properties * Recibe una lista de campos sepados por comas * Retorna un objeto Empty con propiedades basadas * en objetos empty *--------------------------------------------------------------------- * Test: Customer = EmptyObject("Name,Address,Phone,Contacts[5]") Customer.Address = EmptyObject("Street,City,State,Zip,Country") Customer.Name = "John Doe" Customer.Phone = "555-1234" Customer.Address.City = "Sunny Beach" Customer.Address.State = "FL" Customer.Address.Zip = "12345" Customer.Contacts[1] = "Jane Doe" Customer.Contacts[2] = "Jim Doe" *** Revise el objeto Customer Set Step On && Check out Customer object Return Customer *--------------------------------------------------------------------- Function EmptyObject LParameters fieldsList As String If Empty(fieldsList) Then Return Null Endif Local Array fieldsArray[1] Alines(fieldsArray,fieldsList,.T.,",") Local oEmpty oEmpty = NewObject("Empty") Try For Each item In fieldsArray AddProperty(oEmpty,item,"") Endfor Catch oEmpty = Null Endtry Return oEmpty EndFunc *---------------------------------------------------------------------
Esta función fué tomada de los newsgroups de VFP en ingles (con permiso de su autor):Espero que les sea de utilidad.
********************************************
* Subject: Empty Objects
* From: George Nava
* Date: 03/01/2005 7:39
* newsgroup: microsoft.public.fox.programmer.exchange
********************************************
Espartaco Palma, México
No hay comentarios. :
Publicar un comentario
Los comentarios son moderados, por lo que pueden demorar varias horas para su publicación.