WAIT WINDOW "Recreating View with updated fieldnames" NOWAIT > > vp_iPID = 0 > vp_AllRecs = 0 > lcViewName = IIF(goApp.UseLocalData(), "l", "r") + THIS.aCursors[1] > llRetVal = .T. > lcViewCode = DBGETPROP(lcViewName, "VIEW", "SQL") > > > THIS.SetDefaultDatabase() > > &lcViewCode > > > * View Properties > DBSETPROP(lcViewName, 'View', 'UpdateType' , 1) > DBSETPROP(lcViewName, 'View', 'WhereType' , 1) > DBSETPROP(lcViewName, 'View', 'FetchMemo' , .T.) > DBSETPROP(lcViewName, 'View', 'SendUpdates' , .T.) > DBSETPROP(lcViewName, 'View', 'UseMemoSize' , 255) > DBSETPROP(lcViewName, 'View', 'FetchSize' , 100) > DBSETPROP(lcViewName, 'View', 'MaxRecords' , -1) > DBSETPROP(lcViewName, 'View', 'Tables' , SUBSTR(lcViewName, 4)) > DBSETPROP(lcViewName, 'View', 'Comment' , []) > DBSETPROP(lcViewName, 'View', 'BatchUpdateCount', 1) > DBSETPROP(lcViewName, 'View', 'ShareConnection' , .F.) > DBSETPROP(lcViewName, 'View', 'Prepared' , .F.) > DBSETPROP(lcViewName, 'View', 'CompareMemo' , .T.) > DBSETPROP(lcViewName, 'View', 'FetchAsNeeded' , .F.) > DBSETPROP(lcViewName, 'View', 'RuleExpression' , []) > DBSETPROP(lcViewName, 'View', 'RuleText' , []) > DBSETPROP(lcViewName, 'View', 'ParameterList' , [vp_ipid, 'N']) > > > lnOldArea = SELECT(0) > lcConnectName = DBGETPROP(lcViewName, 'View', 'ConnectName') > > > * View Field Properties > SELECT 0 > USE (lcViewName) > > lnFields = AFIELDS(laFields) > > FOR lnCnt = 1 TO lnFields > SELECT (lcViewName) > > lcField = lcViewName + "." + laFields[lnCnt, 1] > > DBSETPROP(lcField, 'Field', 'KeyField' , UPPER(laFields[lnCnt, 1]) = "IID") > DBSETPROP(lcField, 'Field', 'Updatable' , .T.) > DBSETPROP(lcField, 'Field', 'UpdateName' , SUBSTR(lcViewName, 4) + "." + laFields[lnCnt, 1]) > ENDFOR > > USE IN (lcViewName) > > SELECT (lnOldArea) > > WAIT WINDOW "Finished Recreating View with updated fieldnames" NOWAIT