Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to define a Public dynamic array ?
Message
De
01/06/2009 06:06:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/06/2009 05:40:59
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01402913
Message ID:
01402922
Vues:
65
>Hi,
>but I want the array start with 0 element, and I loop the client table if the client fullfill some condition,
>I will insert the client code into the array. then how to define the array and insert into the array ?
>
>
>
>PUBLIC ARRAY aClient[0]
>select client
>do while not eof()
>    if substr(Client.clientcode, 1,1)="A"
>      insert to aClient   <- I don't know how to code it for this part.
>      
>    endif
>    skip 1
>enddo
>
>
PMFJI.

local array myArray[1] && why public!!! local is good if you need to pass make it a member of an object see below
Local loCustomers
loCustomers = Createobject("Empty")
AddProperty(loCustomers, "records", 0)
AddProperty(loCustomers, "aCustomer[1]", Null)

Use (_samples+'data\customer')
loCustomers.RecordS = Reccount()
Dimension loCustomers.aCustomer[reccount()]
Scan
  Scatter Name  loCustomers.aCustomer[recno()]
Endscan
Use

? loCustomers.RecordS
If loCustomers.RecordS > 0
  ? loCustomers.aCustomer[1].Cust_Id
  ? loCustomers.aCustomer[1].Company
  *...
Endif
Or with a collection:
Local loCustomers As Collection, loCustomer
loCustomers = Createobject("Collection")

Use (_samples+'data\customer')
Scan
  Scatter Name loCustomer
  loCustomers.Add( loCustomer, Trim(cust_id) )
Endscan
Use

? loCustomers.Count
If loCustomers.Count > 0
  ? loCustomers[1].cust_id
  ? loCustomers[1].Company
  *...
Endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform