CasewareDocs

SmartGap

Properties:

Example

Sub Main() 
Dim oDB As Object
Dim oTable As Object
Dim oField As Object
Dim oTask As Object
Dim oParameters As Object
Dim oGap As Object
Dim sField As String

Set oDB = Client.OpenDatabase(SmartContext.PrimaryInputFile)
Set oTable = oDB.TableDef

'Get parameters from SmartContext.
Set oParameters = SmartContext.Parameters

If oParameters.Contains("SmartGap1") Then
Set oGap = oParameters.Item("SmartGap1")

If oGap.Type = "C" Then SmartContext.Log.LogMessage "Field type is character"
If oGap.Type = "N" Then SmartContext.Log.LogMessage "Field type is numeric"

sField = oGap.FieldUsed

Set oField = oTable.GetField(sField)
Set oTask = oDB.Gaps

oTask.FieldToUse = sField
If oField.IsCharacter Then
oTask.Mask = oGap.Mask
Else
oTask.Increment = oGap.Increment

If Not oGap.All Then
oTask.UseCutoffs = True
oTask.FromValue = oGap.FromValue
oTask.ToValue = oGap.ToValue
End If
End If

sOutputName = oDB.UniqueFileName("Gap Detection File")
oTask.OutputDBName = sOutputName
oTask-PerformTask

Set oGap = Nothing
Set ofield = Nothing
Set oTask = Nothing
End If

Set oTable = Nothing
oDB.Close
Set oDB = Nothing
End Sub