>Hi.
>I have a situation where I have a set of common DBC in a standard folder, which will always be the same, and then need to store other DBCs in specified folders , depending on a processing year:
>Example:
>
>At Client Site My Development PC
>-------------- -----------------
>
>MYCOMMON In \Common \COMMON
>
>Then depending on the app
> MYDbc1 In \Common\Year1 \Common\DEVELOP
> MyDbc2 In \Common\Year1 \COMMON\DEVELOP
>
> MYDbc1 In \Common\Year2 \COMMON\DEVELOP
> MyDbc2 In \Common\Year2 \COMMON\DEVELOP
>
>The strucure of the DBC and Dbf will be identical but different users could have Year1 and Year2 apps open at the same time.
>
>On my development pc, I would like to maintain and test/develop in just the Common folder and have the app/year specific files in \Common\DEVELOP
>
>I would appreciate any guidance on the best way of handling this. For instance, I think that the Data Environment will hold the \COMMON\DEVELOP hardcoded in and I suspect this will be a problem. I'm also wondering if there are any other issues I should be aware of.
>
>Thanks in advance,
>
>Gerard
Gerard,
A little bit different take than Hiten would be to add everything in the dataenvironment of your form using your development environment. The relative path will be stored in the cursor records of the form but that's okay. Create a mapping table to hold year and directory information. Add code to the BeforeOpenTables event of the Dataenvironment to manipulate the database directory.
Ex.
local lxx, lotemp
local array ladeobjects[1]
for lxx = 1 to amembers(ladeobjects,THIS,2)
lotemp = eval("THIS."+ladeobjects[lxx,1])
if vartype(lotemp) = "O" ;
and upper(lotemp.Baseclass) = "CURSOR" then
wait lotemp.Database window
wait justfname(lotemp.Database) window
lotemp.Database = "new directory here\" + justfname(lotemp.Database)
endif
endfor
You could store the directory in an application object property whenever the user selects the year they want. For development mode, you could add code to check the return value of version(2). If itis greater than 0, you know you are devlopment mode and you can set the path accordingly.
You don't have to call OpenTables because the cursor objects will be in place in the DE and during the default DE instantiation, if AutoOpenTables is .T. the tables will be opened normally.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao