Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public variables VS objects
Message
From
04/06/2003 08:04:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/06/2003 06:00:57
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00795846
Message ID:
00796086
Views:
17
>Good morning Cetin
>
>Hi have a lot of public variables , i want make the same that Rodolfo want .
>But i use a VFP 6 SP5 .
>I "read" this public variables from a table .
>
>Thanks

Good afternoon :)
Pedro in VFP6 it's a little hard. There is not an 'empty' class and 'scatter name' created objects don't expose an AddProperty method. You might use Ken Levy's AddProperty (if I remember right addprop.fll). Alternatively you might use a 'relation', 'session' or 'custom' object - relation and session are lightweight :
USE orders ORDER tag cust_id
oObj = CREATEOBJECT('relation')
lcCustID = ' '
SCAN
 IF cust_id # lcCustID
 	oObj.AddProperty(TRIM(cust_id),CreateObject("relation"))
 	lcCustID = cust_id
 ENDIF
 with eval('oObj.'+TRIM(cust_id))
  .AddProperty('O'-ALLTRIM(order_id),'')
 endwith
 SCATTER NAME ('oObj.'+cust_id-'.O'-ALLTRIM(order_id))
endscan
* Or an easier one is to get all into an array property :
USE orders ORDER tag cust_id
oObj = CREATEOBJECT('relation')
oObj.Addproperty('arrRecords['+trans(reccount())+']',.null.)

SCAN
 scatter name oObj.arrRecords[recno()]
endscan

? oObj.arrRecords[125].cust_id
? oObj.arrRecords[125].order_id
? oObj.arrRecords[125].Order_Date
? oObj.arrRecords[125].Order_Amt

*Verify
go 125
?
? cust_id
? order_id
? Order_Date
? Order_Amt
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
Previous
Reply
Map
View

Click here to load this message in the networking platform