Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tutorial, Course, or Book on ARRAY Handling?
Message
De
09/04/2015 17:07:51
 
 
À
09/04/2015 15:23:49
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Documentation de produit
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01618082
Message ID:
01618103
Vues:
47
>>>>>Does anyone know of a book, course, or tutorial that will teach me how to handle deeper concepts of array handling, something beyond the regular 2-dimensional arrays? My client has one set of arrays that are nested to 10 levels deep. I know that someone on here will say, "Oh, that's a piece of cake (or easy)! An array is just an array."
>>>>
>>>>Can you give us an idea of what it's used for, and what you need to do? Is it used in support of something like a treeview? Or is there advanced math being used e.g. matrix operations?
>>>>
>>>>I don't know how much of this you already know but it may be useful for others:
>>>>
>>>>If you're working in VFP you have DIMENSION to create arrays, then you have to know the syntax for addressing array elements. VFP arrays are one-based (as opposed to many other languages where they are zero-based).
>>>>
>>>>There are various primitive functions available e.g.
>>>>
>>>>ACOPY()
>>>>ADEL()
>>>>AELEMENT()
>>>>AINS()
>>>>ASORT()
>>>>ASUBSCRIPT()
>>>>
>>>>VFP supports only 1- or 2-dimensional arrays. By "nesting" I suspect you've got a situation where the elements of a given array are themselves arrays, and so forth down as deep as 10 levels.
>>>>
>>>>If there's existing code, hopefully it includes some more advanced user-defined functions that let you do things like traverse the links/nesting levels. Code like that is often recursive (or it should be) which tends to be tricky and requires great care in maintaining or enhancing.
>>>>
>>>>As a side note, if you're working with something like a treeview, rather than using nested arrays you can use a single data table (i.e. DBF) and implement a linked list. Processing usually requires writing your own (usually recursive) UDFs. However, depending on what you want to do there may be the option to use dBASE-style ISAM processing (SCAN, GOTO, SKIP etc.) or even the SQL engine. If you're familiar with Fox you may find this approach more intuitive than using arrays.
>>>
>>>I use collections for n-dimensional stuff.
>>
>>Yes, that's another valid approach. I haven't had occasion to go that way but it would probably be very useful if nodes are radically different from one another.
>>
>>If node attributes are similar I really like the table/linked list approach. Great for reporting:
>>
>>SELECT Various, Node, Columns FROM LinkedList WHERE ...
>
>The thing I do not see in the table is how to adress n dimensions. Or do you create something hierachical like root to colum to row to stack to time to whatever? But this is a pain to retrieve.
>
>Not that a collection is easier, but it could be crosslinked much easier, because there is no real restriction in the number of links to create.

I haven't thought about directly supporting N dimensions in a general way, using table/linked list. I suggested it as one approach to support a treeview, where it works well. Just a simple case where every node (except the root node) has a parent node.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform