Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Decimal separator
Message
De
01/07/2005 06:06:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/07/2005 05:49:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Divers
Thread ID:
01027096
Message ID:
01028059
Vues:
19
>Thank you for your answer. I will try your example.
>
>Only one more question: How can I fill the vars and take the data in it to another form while the vars cannot be public?
>
>Greetings,
>Ron

Ron,
You can do it in many ways. What I find easy (and could be used with modal forms that can only return a single variable like functions do) is to create an object, put parameters as its properties (and even a whole table if I need). ie:

Searched and found my customer in current table. I want to return all fields of this record:

scatter name oCustomer
return oCustomer

oCustomer.Cust_id is same as Customer.Cust_id of my record ...

Or as an another example, I want to return all records of a table and info how many records I'm returning (I might need such a thing for various reasons, ie: cursors can't pass between datasessions but objects can, on a form I might want to manage multiple rows at a time etc):
oEmployees = GetRecsSample()
? oEmployees.RecordCount
For ix=1 To oEmployees.RecordCount
	? m.ix,oEmployees.Record[m.ix].First_name,oEmployees.Record[m.ix].Last_name
Endfor

Function GetRecsSample
Select * From employee Into Cursor myCursor
oReturn = Createobject('custom')
oReturn.AddProperty('RecordCount',Reccount('myCursor')) && Count of records I'm returning
oReturn.AddProperty('Record['+Trans(Reccount('myCursor'))+']') && Add array property

Scan
	Scatter Name oReturn.Record[recno()]
Endscan

Return oReturn
endfunc
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform