Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multi-Company
Message
De
10/01/2002 13:36:11
 
 
À
09/01/2002 13:41:00
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Titre:
Divers
Thread ID:
00602619
Message ID:
00603099
Vues:
21
Mike,

I’ve solved this by subclassing the oApp.SetSearchPath method, so that whenever I change the data set (Company / Client), I change the cPathShared property.

When I select a new data set (client), I close all the data for the current company, call the SetSearchPath method again, so that the cPathShared property gets it’s new value pointing to the newly selected company / client. Then I open this company’s database.

I use this data structure:

Data && Appdata.dbc and Appreg01.dbf
Data\Clients
Data\Clients\000001 && Client / Company no 1, client database and tables
Data\Clients\000002 && Client / Company no 2 etc.

Data\Metadata && Stonefield tables

Data\Metadata\Appdata && Copy of the DBCs (Main and Client)

Data\Templates\Clients
Data\Templates\Clients\000001 && Client template no 1
Data\Templates\Clients\000002 && Client template no 2 etc

It gets a bit tricky when you want to distribute new versions of the database where the structure of the tables has changed, but Stonefield Database Toolkit (SDT) makes the job a lot easier. I’ve decided to not update the structure right after an upgrade, but instead check the structure of the data set before opening. My installation routine always overwrites the content in the Data\Metadata and the Data\Metadata\Appdata directory. In one of the tables in the company / client database, I have a field which tells which data version the data set is in. This is just an integer that I increase with one for every change in the structure. Before opening the data set, I check to see if the data version of the main database (or actually the app) is different from the company’s. If the client’s database has a lower version than the main database, I copy the database from the Appdata directory to the client’s directory. Then I use SDT’s Update function to get the structures fixed. This way, I can also allow the user to restore an old backup of the data, even if it has an old structure.

To create a new data set, my users have to create a template first. They do this by opening an existing company and then running a “Save as template” routine. I have decided which tables are emptied first and which aren’t. Doing it this way my users can decide how a new company looks when it is first created. When creating a new data set / company, I simply copy the database and tables in the template directory to the new directory for the new company.

Jens Erik

>First of all thanks for taking the initiative in creating this message area.
>I am just in the beginning process of trying to institute a multi-company solution. I was wondering if any of you had done this already, and might have some suggestions. I am currently focusing, per Codemine support, on the Getfilepath() code.
>
>Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform