Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating views from normalized tables
Message
De
07/05/1999 13:00:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00216070
Message ID:
00216134
Vues:
23
>i have a VFP .dbc that has normalized tables. some of the tables have as many as 30 FK's.
>
>i am trying to create views from these tables and have run into limiltatins on how many joins i can have in a single select statement. through trial and error, i discovered that this limit is 8 joins.
>
>so far, i have gotten around this by creating multiple views. and i know that i can join all of these smaller views into a single view to get the end result that i want.
>
>i am curious to know if this approach is appropriate or if there is some other way to do this. i am concerned that this approach may lead to performance problems down the road when i have lots-o-data in the tables.
>
>thanks, pbd

Instead of creating one large view with 30 joins. Just create a view for each table with a view parameter on the PK.... then you can 'join' the views during runtime, and also only open the views of the data you need at that time...

For example... say you have...

MainTable

And you have lets talk about 5 FK's...

AddressID
PhoneID
JobID
PositionID
EmpTypeID

Open your main view get your data... then you can do something like...

vp_AddressID = v_MainView.AddressID
use v_Address

vp_PhoneID = v_MainView.PhoneID
use v_Phone

vp_JobID = v_MainView.PositionID
use v_Jobs

vp_PositionID = v_mainView.PositionID
use v_Positions

vp_EmpTypeID = v_MainView.EmpTypeID
use v_EmpTypes

**********
You would probaby want to set up a method in your BizObj or Form that populater the ViewParameters for you with one call...

function PopulateViewParameters()

vp_AddressID = v_MainView.AddressID
vp_PhoneID = v_MainView.PhoneID
vp_JobID = v_MainView.PositionID
vp_PositionID = v_mainView.PositionID
vp_EmpTypeID = v_MainView.EmpTypeID

***********
function RequeryChildren()

requery('v_Address')
requery('v_Phone')
requery('v_Jobs')
requery('v_Positions')
requery('v_EmpTypes')

*******************

So.. if your main view changes you can do something like:

vp_MainViewID = NewID
requery('v_MainView')
thisform.PopulateViewParameters()
thisform.RequeryChildren()

**************

Boy... after wrtting this message, am I glad oodles that the framework I use handles most of this.

BOb
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform