* 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.