* dbcViewProp.prg 08-May-98 * load all view field properties from the underlying table field properties * Copyright 1998 DF Software Development, Inc. * http://www.geocities.com/ResearchTriangle/9834/ * Unrestricted public use * Standard disclaimer: Backup your DBC files before running this program * I'm not liable for any damages. While this utility works great on my * views it may fail on the views you have created. local lcDBC, laFields[1], laViews[1], laProperties[6], i, j lcDBC = set( "database" ) if ( empty( lcDBC ) ) * no database open so prompt for one open database ? lcDBC = set( "database" ) if ( empty( lcDBC ) ) return .f. endif endif lcDBC = lcDBC + ".dbc" * list of field properties to copy over to the view * the list of properties is in the help for DBGetProp laProperties[1] = "Caption" laProperties[2] = "Comment" laProperties[3] = "DisplayClass" laProperties[4] = "DisplayClassLibrary" laProperties[5] = "Format" laProperties[6] = "InputMask" *laProperties[] = "" * find all the views in the database select ObjectName, "" ; from (lcDBC) ; into array laViews ; where objecttype = "View" * self join to find all of the view fields select DBC.ObjectName, Tables.ObjectName ; from (lcDBC) as DBC; inner join (lcDBC) as Tables ; on dbc.ParentID = tables.ObjectID ; into array laFields ; where DBC.objecttype = "Field" and tables.ObjectType = "View" wait window "Updating view fields" nowait for i = 1 to _tally laFields[i,1] = lower( alltrim( laFields[i,1] ) ) laFields[i,2] = alltrim( laFields[i,2] ) + "." + laFields[i,1] lcField = dbgetprop( laFields[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, "*", "" ) * set the properties for j = 1 to alen( laProperties ) dbsetprop( laFields[i,2], "Field", laProperties[j], ; dbgetprop( lcField, "Field", laProperties[j] ) ) endfor endfor wait clear use in (lcDBC) return .t.>I know that I can get my database/table/view definitions programmatically by running gendbc. But what I am looking for is a way to generate the programmatic definitions one-at-a-time, so I don't have to run gendbc on the whole database, everytime I add/change a view.