Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL View from view designer
Message
De
25/05/1998 19:27:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00101710
Message ID:
00101760
Vues:
37
Hi Steve,

>
>Yes, you've run into a serious limitation (not a bug) of the VD. The problem stems primarily from the fact that the VD insists on using the "nested" join syntax:
>
>JOIN table1 ;
> JOIN table2 ;
> JOIN table3 ;
> ON expression ;
> ON expression ;
>ON expression
>
>which makes the type of view/query you're trying to do *very* difficult, even programmatically. Better, more intuitive and just as ANSI '92 SQL compliant is the sequential syntax:
>
>JOIN table1 ON expression
> JOIN table2 ;
> ON expression ;
> JOIN table3 ;
> ON expression
>
>The solution?
>
>First, if you're working with an updateable view, what are you doing including more than one table? <bg> Seriously, we can get real clever by creating updateable views that update more than one table, or that include fields from more than one table, but why? This is just asking for trouble and confusion IMO. If you follow the rule of "One table per updateable view" then it becomes trivial and the VD can handle it just fine, allowing you to maintain all the stuff like key fields, and updateable fields etc. in the VD. ReadOnly views that are used to display ancillary information or to populate list objects etc., that often include multiple joins and give the VD fits can be "roughed in" in the VD, then the SQL code saved to a .PRG file, even if it doesn't work - you can move stuff around in your VIEWSCRIPT.PRG until it works ok, and it saves you a lot of typing. Because it's a ReadOnly view (SendUpdates is .F.) you don't have to set or maintain all the other properties. Bracket the code
>in a FUNCTION...ENDFUNC so you can right-click and display the procedures/function list and quickly find the code. This comes in handy when you get a couple hundred views in a DBC <g>.
>
>HTH
>

Thanks for the reply.

Why am I including more than one table in an updatable view. Welllll, that's an interesting answer to your simple question. Actually, I am only trying to update fields from the master table, and bringing a user friendly description of the foreign keys from the joined tables into the view.

I am using MaxFrame Pro. and am immulating an example of the framework sample app. The user friendly descriptions are presented to the user in an F2 lookup field, and when the user selects from the lookup table, the foreign key field of the master table of the view is updated with the primary key from the lookup table, and the view is requeried.

I have heard the rule of thumb concerning one table per updateable view. I just haven't figured out how to apply that rule here, in this context.

I will get back to work on this, and let you know how it turns out. Your last suggestion about the FUNCTION...ENDFUNC is right on target. Thanks.

Kendall
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform