Chapter 4 Extending your Models with Profiles
If the custom check you have defined supports an automatic correction, you can type the body of this function in the Autofix Script tab of the custom check properties.
The autofix is visible in the Check Model Parameters dialog box, it is selected by default if you select the Execute the Automatic Correction by Default check box in the General tab of the custom check properties.
By default, the Autofix Script tab displays the following script items:
We will use the same example as in section Defining the script of a custom check, to define an autofix script that removes the columns with incorrect data type from index.
To define the script of an autofix:
Dim c 'temporary index column Dim col 'temporary column Dim position Dim DT_col
%Fix% = False If obj.type = "LF" or obj.type = "HG" or obj.type = "CMP" or obj.type ="HNG" Then For Each c In obj.IndexColumns Set col = c.column position = InStr(col.datatype,"(") If position <> 0 Then DT_col = Left(col.datatype, position -1) Else DT_col = col.datatype End If If (Ucase(DT_col) = "VARCHAR") And (col.length > 255) Then outmsg = "Automatic correction has removed column " & col.Name & " from index." c.Delete %Fix% = True End If Next End If
Copyright (C) 2008. Sybase Inc. All rights reserved. |