• Like
Feltman collections
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Feltman collections



  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Collections, Arrays & Iteration Mike Feltman F1 Technologies
  • 2. Agenda Collections in VFP Working with Collections Writing Better Code with Collections Using Collections for Object Manipulation Adding Power to VFP Arrays Collections vs. Arrays Merging Arrays & Collections
  • 3. Who Am I President F1 Technologies since 1990 Co-author Visual FoxExpress Consultant Xbase Developer since dBase III/FoxBase 1987
  • 4. “Objects” Collections in VFP _SCREEN, _VFP, FormSet, DataEnvironment, Toolbar, Container, PageFrame, Page, Grid, Column, CommandGroup, OptionGroup, Container, Custom, Control
  • 5. Other Collections in VFP _VFP  Forms  Projects Project  Files  Servers XMLAdapter  Tables XMLTable  Fields
  • 6. “Pseudo” Collections in VFP _SCREEN.Controls  _SCREEN.Forms Form.Controls  FormSet.Forms Custom.Controls  CommandGroup.Buttons Control.Controls  OptionGroup.Buttons Toolbar.Controls  PageFrame.Pages Container.Controls  Grid.Columns Column.Controls
  • 7. The Collection Class New in VFP 8 Key Properties  Count  KeySort (0-3) Key Methods  Add(eItem, cKey, eBefore, eAfter)  Item(eIndex)  GetKey(eIndex)
  • 8. Iterating Collections FOR lnI = 1 TO loCollection.Count FOR EACH loObject in loCollection FOR EACH loObject in loCollection FOXOBJECT Examples: Iterate1.prg, Iterate2.prg, Iterate3.prg
  • 9. UI Support for Collections Listbox ComboBox Example: CollectionDemo.SCX
  • 10. Writing Better Code with Collections Problem: This.Parent.Page2.txtCompany creates a tightly coupled dependency. Solution: Dynamically retrieved Object references eliminate tight coupling. o=o(…) or o=f(…)
  • 11. Using Collections for Multiple Object Manipulations AC CC WC
  • 12. Returning an Array From within a class method a member array can be used as the return value. A function can return an array by calling a class method that returns an array. Example: aConcact in utility.prg
  • 13. Array Utilities aCompact aConcat aFirst aJoin aLast aReverse aUnique aWithout ArrayDemo.Prg
  • 14. Wrapping an Array in a Collection Fox Data Objects – ADO / LINQ like DataCollection.prg, cDataCollection of cData
  • 15. Conclusion Collections in VFP provide convenient ways to access objects Retrieving object references from collections can make code a lot more flexible and stable VFP has a lot of powerful options available on arrays Collection and array implementations are just different enough that each has their own place.