Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to define a Public dynamic array ?
Message
 
À
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:
01402918
Vues:
71
>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
>
>
No, the array can't have zero elements:
PUBLIC ARRAY aClient[1]
select client
lnArrayNumber = 0
do while not eof()
    if substr(Client.clientcode, 1,1)="A"
       lnArrayNumber = lnArrayNumber + 1
       DECLARE aClient[m.lnArrayNumber]
       aClient[m.lnArrayNumber] = 'Something'
    endif
    skip 1
enddo
But BETTER:
SELECT SomethingFromYourTable ;
FROM YourTable;
WHERE substr(Client.clientcode, 1,1)="A";
INTO ARRAY laArray
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform