Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View error after updating a table structure
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01153469
Message ID:
01153485
Views:
33
>Hi... um... the View Script? You mean by clicking on the view in the Project manager, and then selecting Run Query from the menu?
>What if I wanted to do this programatically? For example, one of my views is a parameterized view. If I look at the automated SQL for the view generated there is the following:
>
>SELECT *;
> FROM ;
>     APPDATA!SERVICE;
> WHERE  Service.person_id == ( ?PERSON.PERSON_ID );
> ORDER BY Service.date
>
>
>Then a loooonnng list of DBSETPROPS for each field in the result.

>I guess I'm just not sure how much happens automatically, and how much you have to do manually.
>
>-- L
Yes, that's what I meant. Also if you're using View Editor by Steve Saywer, it has a button to create view script code. You would have to change this script to update the fields names and then run it.

I have the following program to find views affected by a change (either in table name or field name):
*  Program...........: WHICHVIEWSAREAFFECTED.PRG
*  Author............: Mark McCasland
lparameter tcTableName

if empty(m.tcTableName)
	tcTableName = inputbox("Table/Field Name?", "Insert table/field name", ;
		"Product_Lines")
	if empty(m.tcTableName)
		return
	endif
endif

set exclusive off
local lcStr, lcDBC, lcFieldName, lcTableName
lcStr = ""
lcDBC = "MMVisCollect.DBC"
lcFieldName = "%." + lower(m.tcTableName) + "%"
lcTableName = "%!" + LOWER(m.tcTableName) + " %"

select ObjectType, ObjectName, "F" as cStatus, Property ;
	from (m.lcDBC) aa ;
	where aa.ObjectType = 'View' ;
	and aa.ObjectID in ;
	(select ParentID from (m.lcDBC) bb ;
	where lower(Property) like m.lcFieldName) ;
	union all ;
	select ObjectType, ObjectName, "T" as cStatus, Property ;
	from (m.lcDBC) cc ;
	where cc.ObjectType = 'View' ;
	and lower(cc.Property) like m.lcTableName ;
	into cursor crsAffectedViews order by 2,3

scan
	lcStr = m.lcStr + alltrim(ObjectName) + ;
		iif(cStatus="F"," - Fields changes"," - Table changes") + ;
		chr(13) + chr(10)
endscan

_cliptext = m.lcStr
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform