Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set data environment in .prg file
Message
From
25/12/2001 05:31:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/12/2001 04:49:46
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00597887
Message ID:
00598031
Views:
21
>Cetin,
>
>I mean setting a data environment in .prg just like we can do in forms. as i won't use visual tools to design a form and use .prg to generate a form, i want to know how to set data environment in a .prg as we can set it in forms.
>thanks for your reply!!!
>
>Linda

Linda,
I'm not sure I still understand it right. Anyway let me try :)

Now suppose within a dataenvironment you'd put few tables where some are linked.
Dataenvironment would look like (settings imaginary - using testdata.dbc tables to make it more clear):

InitialSelected alias - Customer
Customer - BufferModeOverride = 5, order = 'Company' && Assume this tag existed
Orders - BufferModeOverride = 5, order = 'cust_idx'
* Cust_idx is our modified version of cust_id tag
* We want to have customer orders per particular customer
* from last date to first and created this tag with expression :
* Index on cust_id + dtos(order_date) tag cust_idx DESCENDING
Products - order = 'ProdName' && Again assume this existed - I can't remember if really exists

There is a relation from Customer (cust_id) to table3 (cust_idx tag - cust_id+date combination)

This would translate to .prg code version like this :
* Normally goes to load event for a form
use customer in 0 order tag Company && Open tables with order tags set
use orders in 0 order tag Cust_Idx
use products in 0 order tag ProdName

select customer  && InitialSelectedAlias
set relation to cust_id into Orders && Relation

cursorsetprop('Buffering',5,'customer') && Buffering
cursorsetprop('Buffering',5,'orders')
However I'd ask why not use visual tools ? Use them whenever you can IMHO.
For example DataEnvironment is not just only a visual tool but opening of tables from DE and code use different mechanisms and DE version using lowlevel interfaces is faster (of course it's only a theoritical issue since we don't open hundreths of tables per table to show the difference between DE and in code from load event).
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