Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to create a collection
Message
De
11/06/2004 16:52:17
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00912822
Message ID:
00912922
Vues:
11
>I have a COM process which reads in a low level file into VFP tables. I
>want to create a create a collection property with information about the
>data that was imported.
>
>The structure of the file is below, and I'd like to have the collection
>resemble the layout of the file, so that I can drill down into the
>collection and see info.
>
>For example, with the example below, the collection might have
>an Invoices node, with a value called Count, which is the number
>of invoices.
>
>Each invoice returned from the Invoices node would represent an invoice
>which contains properties such as a Schedule collection, Schedule count...
>
>It seems to me that I would have to create a class for each node, and during
>import add a class for each node type to the collection.
>
>Any ideas?

IMO, you're on the right track, at least for anything that's not the lowest level node. These classes may be collections themselves.

The low level (or end-) nodes can be simple Scatter Name objects, or objects created as createobject("empty"), with a set of custom properties added - this would work for the last record, unless you already have this record somewhere (so it could be Scatter Name'd).

Since you have a low level file, not a cursor, you will need a way to cut the text into lines, lines into fields. Whether you'll use this to fill some intermediate cursors or you'll fill the properties of your objects on-the-fly is entirely up to you. Converting to cursors has the advantage of being able to save the stuff in a well known and defined format. Your collection may need conversion into XML to be saved - but you didn't mention saving as a requirement, so I guess it may not be so important.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform