Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data environment gotcha?
Message
From
28/09/2001 07:43:19
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
27/09/2001 20:57:24
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00561731
Message ID:
00561843
Views:
29
>>I am ready to launch a large project in VFP and find that the tables and views in the forms data environment are bound to the development tables and there is no way to point the forms to the live data when it resides elsewhere, even if it is in the path and has the same directory names, etc. What gives? There must be an easier way. Thanks in advance for any help you can give!
>
>Hiya!! Just thought to tell you I had a simliar pain... compounded by the SysAdmin (me) travelling all over the country and using different servers to get accesss. So, I created a user level id on the boot up of my name when I entered the system. It asks me how I want to access the data 1=local, 2=network, 3=direct to server, 4=direct to test data. This is stored to the oApp.nPathSet. Then, in the beforeopentables of a form dataenvironment... you get this....
>
>* dataenvironment.beforeopentables
>
> * only needed if we are in the actual system
> IF !(TYPE("OApp")=="O")
> RETURN
> ENDIF
> * Set the data directory
> LOCAL lcPathSet, lnCount, lcDatabase
> DO CASE
> CASE oApp.nPathSet = 1
> lcPathSet = "C:\My Documents\Data\"
> CASE oApp.nPathSet = 2
> lcPathSet = "Z:\My Documents\Data\"
> CASE oApp.nPathSet = 3
> lcPathSet = "E:\LiSA\"
> CASE oApp.nPathSet = 4
> lcPathSet = "G:\LiSA\"
> ENDCASE
> * Get list of members of the DataEnvironment
> lnObjects = AMEMBERS(laObjects, THIS, 2)
> * Look at each member object, but only process cursors.
> FOR lnCount = 1 TO lnObjects
> loObject = EVALUATE('THIS.' + laObjects[lnCount])
> IF UPPER(loObject.BaseClass) = 'CURSOR'
> lcDatabase = loObject.Database
> * If this is a free table, we can leave it. Else....
> IF !EMPTY(lcDatabase)
> loObject.Database = lcPathSet + SUBSTR(lcDatabase, RAT('\', lcDatabase) + 1)
> ENDIF EMPTY(lcDatabase)
> ENDIF UPPER(loObject.BaseClass) = 'CURSOR'
> NEXT lnCount
>
>I hope this helps... it certainly makes all of my testing, etc.. easier as I can access test data anywhere.... (help was garnered by D. Hennig on this... I am not THAT clever - yet)....
>
>Ric

Ric,

We have just run into this problem and your (ahem, Doug's) solution is just what we need. Nice idea!

Renoir
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform