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

>
>>Yea, that's what I was thinking too. I did create the view with CREATE SQL VIEW and tried to edit it in the view designer and got the same result.
>
>If it can't create it, it surely can't edit it. *s* You'll have to make edits within the .prg.

Well, I was just checking ya' know!<s>

>
>>It is annoying though that I can't use the designer to set field props because the designer trashes the joins and output fields when I try to edit the view.
>
>Use DBSetProp() if you are copying properties from the underlying data source for the view column use DBGetProp() for the table and use that for DBSetProp().
>
>Here's a util I use to do this:
>
* dbcViewProp.prg
>* copies properties from the table field definitions to the view fields
>lcDBC = set( "database" )
>if ( empty( lcDBC ) )
>   open database ?
>   lcDBC = set( "database" )
>   if ( empty( lcDBC ) )
>      return .f.
>   endif
>endif
>
>lcDBC = lcDBC + ".dbc"
>
>local gaTables[1], gaFields[1], gaViews[1], laProperties[6]
>
>laProperties[1] = "Caption"
>laProperties[2] = "Comment"
>laProperties[3] = "DisplayClass"
>laProperties[4] = "DisplayClassLibrary"
>laProperties[5] = "Format"
>laProperties[6] = "InputMask"
>*laProperties[] = ""
>
>select ObjectName, "" ;
>   from (lcDBC) ;
>   into array gaViews ;
>   where objecttype = "View"
>
>lnViews = _tally
>for i = 1 to lnViews
>   gaViews[i,1] = lower( alltrim( gaViews[i,1] ) )
>   gaViews[i,2] = lower( dbgetprop( gaViews[i,1], "view", "tables" ) + " " )
>endfor
>
>select DBC.ObjectName, Tables.ObjectName ;
>   from (lcDBC) as DBC;
>   inner join (lcDBC) as Tables ;
>      on dbc.ParentID = tables.ObjectID ;
>   into array gaFields ;
>   where DBC.objecttype = "Field" and tables.ObjectType = "View"
>
>for i = 1 to _tally
>   gaFields[i,1] = lower( alltrim( gaFields[i,1] ) )
>   gaFields[i,2] = alltrim( gaFields[i,2] ) + "." + gaFields[i,1]
>   lcField = dbgetprop( gaFields[i,2], "Field", "UpdateName" )
>
>   j = at( ".", lcField )
>   if ( j = 0 )
>      * not a field from a table, likely to be calculated
>      loop
>   endif
>
>   j = at( "!", lcField )
>   if ( j > 0 )
>      * pull the database name off
>      lcField = substr( lcField, j + 1 )
>   endif
>
>   lcField = chrtran( lcField, "*", "" )
>
>   for j = 1 to alen( laProperties )
>      dbsetprop( gaFields[i,2], "Field", laProperties[j], dbgetprop( lcField, "Field", laProperties[j] ) )
>   endfor
>endfor
>
>return .t.
>

Thanks to your util, the annoying part of my problem is history! That's a great idea. Seems like I've seen something like this before, time to check something out...

So I guess that using the VD is really a crutch that isn't necessary except maybe to save some typing.

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