Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question Abt. Data Environment
Message
De
23/12/1997 10:48:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/12/1997 07:19:44
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00067659
Message ID:
00067694
Vues:
29
>>>I have a project which controls our orders season wise, for eg.
>>>
>>>Fall 98
>>>Spring 98
>>>
>>>Fall 97
>>>Spring 97
>>>
>>>Now the structure of main dbf files for the particular season are same, only data is changed..
>>>
>>>I want to setup one main program which consists subdirectiories for the season...
>>>
>>>Like
>>>
>>>c:\mainprog
>>>c:\mainprog\fall98
>>>c:\mainprog\spr98
>>>
>>>& from the software itself it should change the seasons that means, suppose a user selected spr98, all my forms, should load data from that dir...
>>>
>>>My questions are :-
>>>1. How I can do it ??
>>>2. Whether I'll need multiple dbc files or one is enough.
>>>3. Some of the files are common also like setup.dbf, which should always load from the main dir. from where software is running, How software is going to handle that..
>>>
>>>Any Ideas/Suggestions ??
>>Hi,
>>- You could use filter and/or views instead of subdirs.
>>- You could use subdirs as you suggested. If you use multiple dbfs then you would need only one dbc but this would need extra coding loading DE and as years pass many tables would be added to the same DBC.
>>- One DBC and one DBF method is more sense. All you need is to have a copy of the DBC also in subdir. In this case after user selects season you would change your data path with *set path*. This way AppDir need not be changed.
>>ie:
>>public cOld_Path
>>cOld_Path = set("path") && Path without data.
>>..
>>* User selection of SEASON
>>set path to cOld_path + ";" + cSeasonPath
>>Cetin
>
>Thanks for your reply !!! Your suggestion is very useful...
>
>But I'm facing few problems in setting it up...
>
>If I just set the path to my season dir.. it opens file from the dir. where I'm developing the application...
>
>I guess this is because the thisform.dataenvironment.cursor1.database value is set to my application development dir...
>
>Now what I'm doing is Opening the form with Autoopentables=.f.
>
>In the load method of form, I'm setting the value of
>
>thisform.dataenvironment.cursor1.database=myseasondir
>
>& then running Opentables...
>
>Pls tell me :-
>
>1. Am I doing it right way or is there any shortcut..
>2. If my method is right, Is there any generic routine which can loop through all the cursors and set the value...
>3. How I should handle Tables which are common that means dbfs which are having common value for the software.. like setup.dbf..
>
>Pls help...
Hi,
This is a simple example for a generic form loader in your case. I think this is simplier to apply.
To apply it easily you could write this small prg and run it during form design.
**
* Form design mode - to change code in beforeopentables in DE
*
#define nl chr(13)
cPathChanger = "cNewDataPath = _screen.comment"+nl+ ;
... && See below
=aselobj(myArray,2) && Get a reference to DE
myArray[1].writemethod("BeforeOpenTables",cPathChanger)


* Dataenvironment.beforeopentables
cNewDataPath = _screen.comment && or wherever stored
set path to (cNewDataPath)
nDataObjects = amembers(aMyArray,this,2)
cOldPath = this.&aMyArray[1]..database
cNewDbPath = cNewDataPath+substr(cOldPath,rat("\",cOldPath))
for ix = 1 to nDataObjects
if this.&aMyArray[ix]..baseclass = "Cursor"
this.&aMyArray[ix]..database = cNewDbPath
endif
endfor

Here is a way to change path at runtime using above :

*Method processing user data path && Likely to be called instead of do form
lparameters cNewDataPath, fForm
_screen.comment=cNewDataPath && Instead of pub var - if !used to store something else like form instances
do form (fForm)
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