(Code available on CD at “\Sample Code\Client Side VB Script Example.htm”) <HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
<META http-equiv=Content-Type content="text/html; charset=unicode"> <META content="MSHTML 6.00.2800.1170" name=GENERATOR> <SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript> <!--
Sub button1_onclick
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub End If intResultsFound = obRat.DtSearchRat If intResultsFound = 1 Then '=1 Address returned AddressField.value = obRat.DtExtractResultField("Address_Line", 1) LocalityField.value = obRat.DtExtractResultField("Locality", 1) StateField.value = obRat.DtExtractResultField("State", 1) PostcodeField.value = obRat.DtExtractResultField("Postcode", 1) Else '=0 No Address returned '"No Address Returned" End If
'Close Engine
Status = obRat.DtClose If Not Status Then
- 97 -
MsgBox "Error Closing Engine", vbCritical End If End Sub --> </SCRIPT> </HEAD> <BODY>
<FONT face=Arial size=5><STRONG>DataTools Rapid Addressing Tool</STRONG></FONT>
<P><FONT face=Arial><STRONG>Client Side VB Script Example</STRONG></FONT></P>
<Table CELLSPACING=0 BORDER=0 CELLPADDING=2> <TR>
<TD VALIGN="TOP">
<P><INPUT style="WIDTH: 232px; HEIGHT: 33px" type=button size=86 value="Find Address" id=button1 name=button1></P><P>
</TD> </TR> </TABLE>
<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=2 WIDTH=600> <TR>
<TD VALIGN="TOP"> <TR>
<TD VALIGN="TOP">
<P><FONT face=Arial>Address Line</FONT></TD > <TD VALIGN="TOP">
<INPUT id=AddressField name=AddressField style="WIDTH: 347px; HEIGHT: 22px" size=44></P></TD> </TR> <TR> <TD VALIGN="TOP"> <P><FONT face=Arial>Locality</FONT></TD> <TD VALIGN="TOP">
<INPUT id=LocalityField name=LocalityField></P></TD> </TR>
<TR>
<TD VALIGN="TOP">
<P><FONT face=Arial>State</FONT></TD> <TD VALIGN="TOP">
<INPUT id=StateField name=StateField style="WIDTH: 54px; HEIGHT: 22px" size=6></P></TD>
</TR> <TR>
<TD VALIGN="TOP"><P><FONT face=Arial>Postcode</FONT></TD>
<TD VALIGN="TOP"><INPUT id=PostcodeField name=PostcodeField style="WIDTH: 57px; HEIGHT: 22px" size=7></P></TD>
- 98 -
</TABLE> </BODY> </HTML>
- 99 -
Intelli-Search API ExtensionControl Description
The Intelli-Search API Extension adds functions to the Base Australian Rapid API that allows programmers to easily get access to the important DataTools Intelli-Search and Advanced Address Repair technology.
- 100 -
Intelli-Search API Extension Properties & Method
IntelliSearchAddressLine Method
You can use the DtIntelliSearchAddressLine method when you have a full address with incorrect details. This method will use the DataTools Intelli-Search technology to intelligently look for matching PAF records. This method will often return more than one possible address match making it useful where user interaction is available.
Available
Dt Dtx
Syntax
ResultCount = controlname.DtIntelliSearchAddressLine(AddressLine, LocalityLine)
Setting
The DtIntelliSearchAddressLine method uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
ResultCount Returns an Integer value that is the number of matching results
found from the PAF. (Note: Number of 9999 is returned if not available on installed version)
AddressLine Required. A full address line eg. „1000 Greatwestern Hwy'
LocalityLine Required. A full locality line eg. „PROSPECT NSW‟
Visual Basic Example
(Code available on CD at “\Sample Code\DtIntelliSearchAddressLine.bas”) Public Sub main()
Dim obRat As Object
Dim strAddressLine As String Dim strLocality As String Dim strState As String Dim strPostcode As String
Dim intNumberOfResultsFound As Integer Dim i As Integer
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
- 101 -
intNumberOfResultsFound = obRat.DtIntelliSearchAddressLine("1000 Greatwestern
Hwy", "PROSPECT NSW") For i = 1 To intNumberOfResultsFound strAddressLine = obRat.DtExtractResultField("Address_Line", i) strLocality = obRat.DtExtractResultField("Locality", i) strState = obRat.DtExtractResultField("State", i) strPostcode = obRat.DtExtractResultField("Postcode", i) Debug.Print "Result number " & i
Debug.Print strAddressLine
Debug.Print strLocality & " " & strState & " " & strPostcode Next
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 102 -
SearchAddressLineAdvanced Method
You can use the DtSearchAddressLineAdvanced method when you have a full address with incorrect details. This method will use the DataTools Advanced Address Repair technology to intelligently look for a matching PAF record. This method is suitable for batch address repair as it will never return more than one address.
Available
Dt Dtx
Syntax
ResultCount = controlname.DtSearchAddressLineAdvanced(AddressLine, LocalityLine)
Equivalent Dtx method
ResultCount = controlname.DtxSearchAddressLineAdvanced(Instance, AddressLine, LocalityLine)
Setting
The DtSearchAddressLineAdvanced method uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
ErrorCode Returns an Integer value that is the error code for why an
address didn‟t match. (Note: Number of 9999 is returned if not available on installed version)
AddressLine Required. A full address line eg. '27 hintr St'
LocalityLine Required. A full locality line eg. 'HARRIS PARK NSW 2150'
Return Values
See DtSearchAddressLineAMAS and DtConvertErrorCode methods for details. Remarks
When using the DtSearchAddressLineAdvanced method DPIDs are not returned through the extract fields method. To retrieve a DPID the repaired address must be then processed using the DtSearchAddressLineAMAS method.
Visual Basic Example
(Code available on CD at “\Sample Code\DtSearchAddressLineAdvanced.bas”) Public Sub main()
Dim obRat As Object
Dim strAddressLine As String Dim strLocality As String Dim strState As String Dim strPostcode As String Dim intErrorCode As Integer
- 103 -
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
intErrorCode = obRat.DtSearchAddressLineAdvanced("27 hintr St", "HARRIS PARK NSW 2150") If intErrorCode = 0 Then strAddressLine = obRat.DtExtractResultField("Address_Line", 1) strLocality = obRat.DtExtractResultField("Locality", 1) strState = obRat.DtExtractResultField("State", 1) strPostcode = obRat.DtExtractResultField("Postcode", 1) Debug.Print strAddressLine
Debug.Print strLocality & " " & strState & " " & strPostcode End If
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 104 -
Twins Pro API Extension Control Description
The Twins API Extension Active-X control allows the use of the DataTools Twins matching technology within third party applications.
- 105 -
Twins Pro API Extension Properties & Method
CreateMatchMethods Method
You can use the DtTwins_DtCreateMatchMethods method to create keys for all loaded match methods for the information loaded.
Available
Dt Dtx
Syntax
Status = controlname.DtTwins_DtCreateMatchMethods
Setting
The DtTwins_DtCreateMatchMethods method uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
Status Returns a Boolean expression of the create match methods
status. True means methods were created successfully, False means error in creating match methods.
Visual Basic Example
(Code available on CD at “\Sample Code\DtTwins_DtCreateMatchMethods.bas”) Public Sub main()
Dim strTitle As String, strFirstName As String, strLastName As String Dim strAddressLine1 As String, strAddressLine2 As String
Dim strLocality As String, strState As String, strPostcode As String
Dim obRat As Object
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Load variables with record data strTitle = "Mrs"
strFirstName = "Jane" strLastName = "Plain"
- 106 -
strAddressLine2 = "Lot 2 Japara Rd" strLocality = "DRAPER"
strState = "QLD" strPostcode = "4520"
'Initialise object input data fields obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation Status = obRat.DtTwins_DtLoadDataField("title", strTitle)
Status = obRat.DtTwins_DtLoadDataField("first_name", strFirstName) Status = obRat.DtTwins_DtLoadDataField("last_name", strLastName)
Status = obRat.DtTwins_DtLoadDataField("address_line_1", strAddressLine1) Status = obRat.DtTwins_DtLoadDataField("address_line_2", strAddressLine2) Status = obRat.DtTwins_DtLoadDataField("locality", strLocality)
Status = obRat.DtTwins_DtLoadDataField("State", strState)
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode)
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract 'Person and Address' match method
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Person_and_Address")
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 107 -
EraseDataFields Method
You can use the DtTwins_DtEraseDataFields method to erase all information loaded through the DtTwins_DtLoadDataField property.
Available
Dt Dtx
Syntax
controlname.DtTwins_DtEraseDataFields
Setting
The DtTwins_DtEraseDataFields method uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
Visual Basic Example
(Code available on CD at “\Sample Code\DtTwins_DtEraseDataFields.bas”) Public Sub main()
Dim strAddressLine1 As String, strAddressLine2 As String
Dim strLocality As String, strState As String, strPostcode As String
Dim obRat As Object
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Load variables with record data strAddressLine1 = "Suite 10, Level 2" strAddressLine2 = "27 Hunter St" strLocality = "PARRAMATTA" strState = "NSW"
strPostcode = "2150"
'Initialise object input data fields
obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation
- 108 -
Status = obRat.DtTwins_DtLoadDataField("address_line_2", strAddressLine2) Status = obRat.DtTwins_DtLoadDataField("locality", strLocality)
Status = obRat.DtTwins_DtLoadDataField("State", strState)
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode)
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract match method
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Tight_Address")
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 109 -
ExtractMatchMethods Property
You can use the DtTwins_DtExtractMatchMethods property to extract match method keys that were created from the loaded data using the DtTwins_DtCreateMatchMethods method.
Available
Dt Dtx
Syntax
MatchMethodKey = controlname.DtTwins_DtExtractMatchMethods(MatchMethodName)
Setting
The DtTwins_DtExtractMatchMethods property uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
MatchMethodKey Returns a string expression that is the requested match method
key.
MatchMethodName Required. A valid match method name.
The MatchMethodName argument has these settings:
Value Person_and_Address Tight_Person_and_Address Tight_Person_and_Loose_Address Business_and_Address Tight_Business_and_Address Loose_Business_and_Tight_Address Tight_Address Email Telephone Reference_Number
Match Methods Description
For a detail explanation on the Twins Pro matching methods as listed above see the 'Match Methods' chapter of the 'Twins Benefits & Features Guide'.
Visual Basic Example
(Code available on CD at “\Sample Code\DtTwins_DtExtractMatchMethods.bas”) Public Sub main()
Dim strBusinessName As String
Dim strAddressLine1 As String, strAddressLine2 As String
- 110 -
Dim obRat As Object
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Load variables with record data
strBusinessName = "The Right Company" strAddressLine1 = "Level 1" strAddressLine2 = "202 Halifax St" strLocality = "ADELAIDE" strState = "SA" strPostcode = "5000"
'Initialise object input data fields obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation
Status = obRat.DtTwins_DtLoadDataField("business_name", strBusinessName) Status = obRat.DtTwins_DtLoadDataField("address_line_1", strAddressLine1) Status = obRat.DtTwins_DtLoadDataField("address_line_2", strAddressLine2) Status = obRat.DtTwins_DtLoadDataField("locality", strLocality)
Status = obRat.DtTwins_DtLoadDataField("State", strState)
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode)
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract match method
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Business_and_Address")
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Tight_Business_and_Address")
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 111 -
LoadDataField Property
You can use the DtTwins_DtLoadDataField property to specify the data you would like used for the next match method creation using the DtTwins_DtCreateMatchMethods method.
Available
Dt Dtx
Syntax
controlname.DtTwins_DtLoadDataField(InputFieldName, InputData)
Setting
The DtTwins_DtLoadDataField property uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
InputFieldName Required. A valid input field name.
InputData Required. A string expression specifying the data you would like
to load into the requested field.
The InputFieldName argument has these settings:
Value Description
Title Person's title eg. Mr, Mrs
First_Name Person's first name
Last_Name Person's last name
Business_Name Business' name
Address_Line_1 First address line
Address_Line_2 Second address line
Address_Line_3 Third address line
Address_Line_4 Forth address line
Locality Address locality
State Address state
Postcode Address postcode
Phone Phone number
Email E-mail address
Visual Basic Example
(Code available on CD at “\Sample Code\DtTwins_DtLoadDataField.bas”)
Public Sub main()
Dim strAddressLine1 As String
Dim strLocality As String, strState As String, strPostcode As String
- 112 -
Set obRat = CreateObject("DataTools_DtRat.Dt") 'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Load variables with record data strAddressLine1 = "PO Box 10001" strLocality = "PINES FOREST" strState = "VIC"
strPostcode = "3200"
'Initialise object input data fields obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation
Status = obRat.DtTwins_DtLoadDataField("address_line_1", strAddressLine1) Status = obRat.DtTwins_DtLoadDataField("locality", strLocality)
Status = obRat.DtTwins_DtLoadDataField("State", strState)
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode)
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract match method
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Tight_Address")
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 113 -
OptionSetting Property
You can use the DtTwins_DtOptionSetting property to set special option setting.
Available
Dt Dtx
Syntax
controlname.DtTwins_DtOptionSetting(OptionType, OptionSetting)
Setting
The DtTwins_DtOptionSetting property uses the following settings.
Argument Description
controlname The name of the RAT Active-X control object.
OptionType Required. A valid option type.
OptionSetting Required. A string expression specifying the option you would like to specify for the requested setting.
The DtTwins_DtOptionSetting argument has these settings:
Option Type Valid Option Setting Description
pla_setting 0 Postal locality awareness function off.
1 – 7 Postal locality awareness function on.
1 Least intense with fastest processing
5 Best balance (Default)
7 Most intense with slowest processing
Postal Locality Awareness Description
For a detail explanation on the Twins Pro Postal Locality Awareness technology as described above see the 'Postal Locality Awareness' chapter of the 'Twins Benefits & Features Guide'.
Visual Basic Example
(Code available on CD at “\Sample Code\DtTwins_DtOptionSetting.bas”) Public Sub main()
Dim strAddressLine1 As String
Dim strLocality As String, strState As String, strPostcode As String
Dim obRat As Object
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
- 114 -
If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Setting the Postal Locality Awareness option to 7 will 'have this example create the same match method key as if 'the address was correct.
obRat.DtTwins_DtOptionSetting "pla_setting", 7
'Load variables with record data strAddressLine1 = "PO Box 10001"
strLocality = "PINES" 'Should be PINES FOREST strState = "VIC"
strPostcode = "3200" 'Should be 3200
'Initialise object input data fields obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation
Status = obRat.DtTwins_DtLoadDataField("address_line_1", strAddressLine1) Status = obRat.DtTwins_DtLoadDataField("locality", strLocality)
Status = obRat.DtTwins_DtLoadDataField("State", strState)
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode)
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract match method
Debug.Print obRat.DtTwins_DtExtractMatchMethods("Tight_Address")
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 115 -
Twins Pro API Extension Sample VB Code
Sample Description
The sample below compares two records against each other using the 'Person and Address' match method with Postal Locality Awareness set to level 7.
The two records that are being compared are:
Title First Name Last Name Address Line 1 Suburb State Postcode
Mrs Alexandra Pierson 20 Southern Cross Arc (next To Darling Park) RUNDLE MALL SA 5000
Ms Alex Peirsun Darling Park 20 Southern Cross Arc ADELAIDE SA
Sample code
(Code available on CD at “\Sample Code\VbTwinsProExtentionSample.bas”) Public Sub main()
Dim intRecordID As Integer
Dim strTitle(1 To 2) As String, strFirstName(1 To 2) As String, strLastName(1 To 2) As String
Dim strAddressLine1(1 To 2) As String, strLocality(1 To 2) As String Dim strState(1 To 2) As String, strPostcode(1 To 2) As String
Dim strPersonAndAddressMatchMethod(1 To 2) As String
Dim obRat As Object
Set obRat = CreateObject("DataTools_DtRat.Dt")
'Open Engine
Status = obRat.DtOpen If Not Status Then
MsgBox "Error Opening Engine", vbCritical Exit Sub
End If
'Load variables with record data.
'Note misspellings and differences in formatting between both records 'Load Record 1
strTitle(1) = "Mrs"
strFirstName(1) = "Alexandra" strLastName(1) = "Pierson"
strAddressLine1(1) = "20 Southern Cross Arc (next To Darling Park)" strLocality(1) = "RUNDLE MALL"
strState(1) = "SA" strPostcode(1) = "5000" 'Load Record 2 strTitle(2) = "Ms" strFirstName(2) = "Alex" strLastName(2) = "Peirsun"
strAddressLine1(2) = "Darling Park 20 Southern Cross Arc" strLocality(2) = "ADELAIDE"
- 116 -
strPostcode(2) = ""
'Set Postal Locality Awareness setting
obRat.DtTwins_DtOptionSetting "pla_setting", 7
'Loop through both records creating match method key For intRecordID = 1 To 2
'Initialise object input data fields obRat.DtTwins_DtEraseDataFields
'Load record data into object preparing for match method creation Status = obRat.DtTwins_DtLoadDataField("title", strTitle(intRecordID))
Status = obRat.DtTwins_DtLoadDataField("first_name", strFirstName(intRecordID)) Status = obRat.DtTwins_DtLoadDataField("last_name", strLastName(intRecordID))
Status = obRat.DtTwins_DtLoadDataField("address_line_1",
strAddressLine1(intRecordID))
Status = obRat.DtTwins_DtLoadDataField("locality", strLocality(intRecordID)) Status = obRat.DtTwins_DtLoadDataField("State", strState(intRecordID))
Status = obRat.DtTwins_DtLoadDataField("Postcode", strPostcode(intRecordID))
'Process match method creation
Status = obRat.DtTwins_DtCreateMatchMethods
'Extract 'Person and Address' match method and load into record strPersonAndAddressMatchMethod(intRecordID) = _
obRat.DtTwins_DtExtractMatchMethods("Person_and_Address") Next
'Check if both records match or not
If strPersonAndAddressMatchMethod(1) = strPersonAndAddressMatchMethod(2) Then MsgBox "Record 1 and 2 have been detected as duplicate records"
Else
MsgBox "Record 1 and 2 have not been detected as duplicate records" End If
'Close Engine
Status = obRat.DtClose If Not Status Then
MsgBox "Error Closing Engine", vbCritical End If
- 117 -
Twins Pro API Extension Sample Query Code
Sample Description 1
The sample below appends all duplicate match keys from the MyData table to the MyNameMatches table.