address object emailobject nameobject...

33
AddressObject Email Object NameObject PhoneObject Quick Start Guide for .NET

Upload: others

Post on 07-May-2020

15 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

AddressObject EmailObject NameObject PhoneObject

Quick Start Guide for .NET

Page 2: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Data Quality Suite

Quick Start Guide for .NET Developers

Page 3: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

COPYRIGHTInformation in this document is subject to change without notice. Companies, names, and data used in examples herein are fictitious unless otherwise noted. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Melissa Data Corporation. This document and the software it describes are furnished under a license agreement, and may be used or copied only in accordance with the terms of the license agreement.

Copyright © 2010 by Melissa Data Corporation. All rights reserved.

Information in this document is subject to change without notice. Melissa Data Corporation assumes no responsibility or liability for any errors, omissions, or inaccuracies that may appear in this document.

TRADEMARKSData Quality Suite, Address Object, Phone Object, Name Object, and Email Object are registered trademarks of Melissa Data Corp. Windows is a registered trademark of Microsoft Corp.

The following are registered trademarks of the United States Postal Service®: CASS, CASS Certified, DMM, DPV, DSF2, eLOT, First-Class Mail, LACSLink, NCOALink, PAVE, Planet Code, Post Office, Postal Service, RDI, Standard Mail, U.S. Postal Service, United States Post Office, United States Postal Service, USPS, ZIP, ZIP Code, and ZIP + 4.

DSF2 are provided by a nonexclusive licensee of the USPS. Melissa Data is a nonexclusive Interface Distributor and NCOALink Full Service Provider, DPV and LACSLink Licensee of the United States Postal Service. The prices for NCOALink and DPV services are not established, controlled, or approved by the United States Postal Service.

MELISSA DATA CORPORATION22382 Avenida EmpresaRancho Santa Margarita, CA 92688

Phone: (800) MELISSA (1-800-635-4772)Fax: 949-589-5211

E-mail: [email protected]: www.MelissaData.com

For the most recent version of this document, visit http://www.melissadata.com/tech/tech.htm

Document Code: DQSQSNRevision Number: 100624.035Last update: June 24, 2010

ii

Page 4: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

WELCOME TO THE DATA QUALITY SUITE

These customizable developer tools have been designed to help you efficiently manage your contact data for superior performance and profitablity. This is the crucial point that turns collected data into usable information. Depending on the objects you have purchased from this Suite, you will be able to verify and standardize addresses, validate phone numbers and update area codes, parse and genderize names, validate email addresses, and more.

ABOUT ADDRESS OBJECTClean up contact data of bad, incomplete information before it invades your database and creates a negative impact on your data-driven initiatives. You’ll reduce undeliverables, increase communication efforts and save money on all your direct marketing and CRM campaigns.

Address Object’s functionality is divided into four interfaces: AddressCheck, Parse, StreetData, and ZipData.

• AddressCheck can verify that an address is a properly formatted address that matches a true and valid point of delivery using the DPV® database. It also matches the address to the LACSLink® file to determine if the address has been converted (usually from a rual route to a standard city-street address) and automatically updates the address.

The CASS Certified™ address checking logic includes DPV and LACSLink processing mandatory to qualify your mailings for postal discount by appending the ZIP + 4® codes to only validated addresses. Address Object also generates Form 3553 required by the Postal Service™ to claim the discounts.

The AddressCheck interface also enhances your mailing list by providing additional information, such as Congressional District, County name and FIPS code, time zone and more.

• The Parse interface breaks down a street address into its component parts, such as street number, directional (S, NW and so on), street name and suffix (ST, RD, BLVD).

If the first pass does not yield the expected results because the street address follows a non-standard format, the ParseNext function will offer an alternate parsing.

The AddressCheck interface also parses the submitted data, but the Parse interface can be used without initializing the data files required for AddressCheck, making Parse faster to use when full address checking is not necessary.

This interface can also parse Last Line data (city, state and ZIP Code™) into the separate parts. This is handy if your address data comes to you as lines of plain text instead of discrete fields.

• The StreetData interface can match a street name or just a partial name against a ZIP Code and return the known valid address ranges that match that pattern.

1

Page 5: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Used in conjunction with the AddressCheck interface, StreetData can be used to match incorrect or misspelled addresses to a valid address range. For example, if “123 Main Ave” is not a valid address for the ZIP Code, the StreetData interface can determine that the number 123 falls within a valid range for “Main St,” allowing you to use an address record that would otherwise result in an undeliverable mail piece.

• The ZipData interface performs several functions, matching geographic data to ZIP Code and city information.

First, the FindZip function returns geographic data about one or more city names that match the input ZIP Code, including automation (or carrier route) information, county name and FIPS code, postal facility type, official “last line” indicator, and latitude/longitude for each match. The FindZipInCity functions can return the same information for every ZIP Code that matches that input city and state combination. The FindCityInState functions can determine if the input full or partial city name matches a valid city name with the state. This can be useful to help correct misspelled city names in your mailing list.

ADD-ONS TO ADDRESS OBJECT• Canadian Address Object — Increase the accuracy of your Canadian addresses. Use

this API with your custom PC & Web applications to validate, correct and standardize Canadian addresses and qualify your mailings to meet Canada Post requirements.

• RBDI (Residential Business Delivery Indicator) — Most shipping carriers charge a higher price for residential deliveries. RBDI helps ensure that you select the most cost-effective method for shipping parcels by identifying residential addresses... therefore maximizing your savings potential.

ABOUT PHONE OBJECTUse Phone Object to reduce data entry errors, catch area code splits early, save time looking up area codes, provide dealer lookup for customers, and link U.S. numbers to city, state, ZIP Code, and county.

Phone Object takes a phone number with an area code, parses it and retrieves geographic data corresponding to the area code and prefix. It can also update phone numbers that have undergone a recent area code split, helping to keep your data current and error-free.

Also, by parsing your phone number data and relating each area code and prefix to geographic information, such as longitude and latitude, Phone Object can provide an additional tool for planning a marketing campaign.

ABOUT NAME OBJECTUse Name Object to increase response rates with personalized messages, merge individual components into form documents, identify gender makeup of your list for more targeted marketing, and reduce waste on fraudulent entries.

2

Page 6: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Name Object takes a string containing one or two full names, such as “John James Smith” or “Mr. John J. Smith and Ms. Mary Jones,” and breaks it into first, middle and last names, as well as any titles, generational suffixes, or other information.

Name Object will also attempt to indicate the gender of the person based on the first name, if possible. For instance, “James” would return an “M” for male, “Cheryl” an “F” for female but names like “Chris” or “Tracy” can be either male or female and would return “N” for “neutral.” Name Object can be configured to give preference to either male or female for lists that have a strong bias toward one gender or another.

Name Object will also flag names containing possible vulgar words to help you screen out possible hoaxes, pranks, nuisance names (“Mickey Mouse”) and possible Company Names (“Microsoft, Inc”). It can also create salutations, such as “Dear Mr. Jones,” using the parsed name information (Salutation uses the first person’s name if two full names are present).

ABOUT EMAIL OBJECTEmail Object gives integrators a simple way to verify, correct, and standardize email address domains, to ensure legitimate email addresses are captured in contact databases. Email Object can be used in batch or at the point of entry, and has three optional levels of verification: Syntax, Local Database, and MXlookup. Email Object also allows for easy customization of domain changes, common misspellings, and suppression of bad domains.

FEATURES INCLUDE: • Check for and remove syntax errors: (@@#$5!..`]>

• Standardize Casing [email protected] -> [email protected]

• Check for and update domain name changes @home.com –> cox.net

• Check for and correct top level domain name (TLD) .con-> .com

• Check for and correct misspellings in the domain: yohoo.com -> yahoo.com

• Validate a domain name against a database of known good and bad domains

• Validate domains via an optional MaileXchange (MX) Lookup

• Parse email addresses into various components: bud, @, 800mail, com

• Return the top level domain description

3

Page 7: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

AN EXAMPLEThe following is an example of what the Data Quality Suite can return from a given set of data

CONTACT DATA SUBMITTEDName ......Mr. John Wayne Brown, Jr & Mrs. Mary Elizabeth Brown

Company ......Melissa DataAddress ......22382 Emprisa

ZIP Code ......92688Phone ......7145895200x111Email ...... [email protected]

TRIAL VERSIONSAll of the Data Quality Tools found on the DVD Suite can be used in demo mode to help you get familiar with our products before purchasing a license. The trial versions contain the same features found in the full versions, but are limited. Address Object and GeoCoder Object will only process ZIP™ codes in Nevada. Phone Object will only process Nevada area codes.

ADDRESS DATA RETURNEDCompany ......Melissa Data

Address ......22382 Avenida EmpresaCity ......Rancho Santa Margarita

City Abbreviation ......Rcho Sta MargState ......CA

ZIP ......92688Plus4 ......2112Suite ...... [N/A]

Carrier Route ......C056Delivery Point ......821County Name ......OrangeCounty FIPS ......C06059

Time Zone ......PacificPMSA ......5945LACS ...... [N/A]

Address Type ......SPrivate Mailbox ...... [N/A]

Latitude ......33.6480Longitude ...... -117.6000

Congressial Dist ......48Status ......Verified

NAME DATA RETURNEDFIrst Name ...... John

Middle Name ......WayneLast Name ......Brown

Prefix ......MrSuffix ...... Jr

Gender ......MaleFirst Name 2 ......Mary

Middle Name 2 ......ElizabethLast Name 2 ......Brown

Prefix 2 ......MrsGender 2 ...... Female

PHONE DATA RETURNEDArea Code ...... 714

Prefix ...... 589Suffix ...... 5200

Extension ...... 111Distance ...... [N/A]

New Area Code ...... 949Status ......Corrected

EMAIL DATA RETURNEDTLD ...... com

domain ......melissadataTLD Description ......Operated by Verisign

Email ...... [email protected] ......Verified

4

Page 8: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

The trial versions for Name Object and Email Object can be used with a free 30-day license, after which the object must be purchased to continue using.

If you wish to purchase any or all of the tools in this Suite, simply contact your sales representative at 1-800-MELISSA (1-800-635-4772). Upon purchasing the product, you will be provided with a license string to unluck its full functionality.

WHERE TO FIND HELP

SYSTEM REQUIREMENTS

The Data Quality Suite is shipped on a DVD. It is recommended that you copy the data files to your local or network hard drive in order to access the data faster. Because these objects are in essence programmer’s tools, they should be installed on a system that has a development environment in order to utilize the power of the objects.

The following are additional hardware and software requirements:

Reference Guide

The Data Quality Suite Reference Guide contains the functions available for the various objects. A PDF file of this guide is located on your DVD-ROM.

To view using other operating systems, you must have Adobe Acrobat Reader installed on your computer. This program can be downloaded from the Adobe web site (http://www.adobe.com).

The Quick Start Guide and the Reference Guide are also available in HTML format. You can access this from the Technical Support web page on the Melissa Data web site (www.MelissaData.com).

Melissa Data Web Site

Check out the technical support section on our web site at www.MelissaData.com, where you can view the current application notes and FAQs. Our web site also contains the latest product information for the Data Quality Suite and other Melissa Data products.

Call Us Toll Free

If you need help using the Data Quality Suite, please call Technical Support toll free at 1-800-MELISSA (1-800-635-4772). Our technical support staff is available Monday through Friday from 6 a.m. - 5 p.m. Pacific Standard Time. You can also post a question on our forums at http://forum.MelissaData.com or send an e-mail to [email protected].

5

Page 9: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

• 2GB hard disk space (for data files)

• Windows 2000, XP, Server 2003 or Server 2008 (32 or 64 bit); Pentium III or better. Most Windows-based programming languages.

The actual deployment system does not require use of the development tools.

INSTALLING THE DATA QUALITY SUITE

1. Close all applications that are open, including any anti-virus and e-mail software.

2. Place the Data Quality Suite DVD in your DVD-ROM drive.

3. Click the Start button, and then select Run from the pop-up menu. The Run dialog box opens.

4. Type your DVD drive letter followed by :\SETUP.EXE in the Command Line box. (For example, D:\SETUP.EXE). After typing the path, click OK.

5. Read the license agreement, and then click Yes if you agree to the terms. (To proceed with the installation, you must accept this agreement.)

6. Select the component or components that you want to install by placing a check mark next to its name and clicking Next.

7. The Data Quality Suite

8. Click Next.

9. Click Install.

FILE LOCATIONS

Most of the files are placed in subdirectories of C:\Program Files\Melissa Data\DQT\. During the installation process, there may be some files placed in your Windows system directory — these files are required by the Microsoft Visual C++ runtime.

CONFIGURING THE DATA QUALITY SUITE

A current license string is required to use the full functionality of the object in the Data Quality Suite. Without a license string, they will work in demo mode.

The license string should be entered as an environment variable. This allows you to update your license string without editing and recompiling your code. You must still call the SetLicenseString function, but you simply pass an empty string as the parameter.

6

Page 10: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

These are the environment variable names for the objects in the Data Quality Suite:

• Address: MDADDR_LICENSE

• Phone: MDPHONE_LICENSE

• Name: MDNAME_LICENSE

• Email: MDEMAIL_LICENSE

SETTING THE LICENSE STRING ENVIRONMENT VARIABLEWindows users can set environment variables by doing the following:

1. Select Start > Settings, and then click Control Panel.

2. Double-click System, and then click the Advanced tab.

3. Click Environment Variables, and then select either System Variables or Variables for the user X.

4. Click New.

5. Enter the variable name (MDADDR_LICENSE, MDPHONE_LICENSE, MDNAME_LICENSE, or MDEMAIL_LICENSE) in the Variable Name box.

6. Enter the license string in the Variable Value box and then click OK.

Please remember that these settings take effect only upon start of the program. You may need to quit and restart the development environment to incorporate the changes.

SAMPLE IMPLEMENTATION

This section describes how to build simple applications using the objects in the Data Quality Suite. We will be using Visual Basic.NET for illustration purposes.

INSTANTIATION AND INITIALIZATIONDeclaring and creating an instance of the object being used is followed by one or more initialization steps to prepare it for use. These steps only need to be performed once per instance of the object in use.

LOOKUPIn this section, the required data is passed to the input functions and the VerifyAddress function to process the data is called. Many functions in this suite accept the input data as parameters and do not require that any “set” functions be called before calling them.

PROCESSINGIn the processing stage, you’ll display or examine the return values of the “get” functions.

7

Page 11: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

TERMINATIONThis stage involves destroying the current instance of the object in use when you close the application, freeing up memory to be used by other processes.

ADDRESS OBJECT SAMPLE — ADDRESSCHECKIn order to use the .NET wrapper, you will need to copy two DLL files from the Data Quality Suite DVD to a local folder. These files, mdAddrNET.dll and mdAddrCS.dll are located in the address\windows\interfaces\net folder. Copy the files to a location inside your project folder.

The .NET wrapper must be able to find the Address Object’s standard DLL file, mdAddr.dll. The simplest method is to copy this file from the installed location, normally “C:\Program Files\Melissa DATA\DQT\AddrObj,” to the same folder that contains mdAddrNET.dll and mdAddrCS.dll.

Step 1 — Instantiation: Add a Project ReferenceEvery Visual Basic project that uses an external component like Address Object has to start with a project reference.

1. Select Project > Add Reference...

2. Click on the Browse tab of the Reference dialog and open the folder where you copied the two .NET wrapper files.

3. Select the file named mdAddrNET.dll.

4. Click OK.

Step 2 — Instantiation: Add an Object DeclarationBegin by declaring the object as a new object variable.

VB.NETPrivate addrObj As New MelissaData.mdAddr

C#.NETmdAddr addrObj = new MelissaData.mdAddr

Step 3 — Initialization: Set the License StringCall the SetLicenseString function for Address Object to retrieve the license string from the MDADDR_LICENSE environment variable.

VB.NETaddrObj.SetLicenseString("")

C#.NETaddrObj.SetLicenseString("");

8

Page 12: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 4 — Initialization: Error CheckingThe next step is to tell Address Object where it can find its data files. The initialization will either be successful, or an error message will display stating why the error occurred.

The path to the Canadian data files is only necessary if you are using those options. The path to the U.S. data files can be omitted if you are only processing Canadian address data.

The initialization error code is returned as a text string.

VB.NETPrivate dPath = "C:/Program Files/Melissa Data/DQT/Data Files"addrObj.SetPathToUSFiles(dPath)addrObj.SetPathToDPVDataFiles(dPath)addrObj.SetPathToLACSLinkDataFiles(dPath)addrObj.SetPathToCanadaFiles(dPath)

If (addrObj.InitializeDataFiles() <> 0) ThenInitErrorString = addrObj.GetInitializeErrorString

ElseInitErrorString = addrObj.GetInitializeErrorStringDatabaseDate = addrObj.GetDatabaseDateExpDate = addrObj.GetExpirationDateBuildNum = addrObj.GetBuildNumber

End If

C#.NETprivate static string dPath = "C:\\Program Files\\Melissa

Data\\DQT\\Data Files";addrObj.SetPathToUSFiles(dPath);addrObj.SetPathToDPVDataFiles(dPath);addrObj.SetPathToLACSLinkDataFiles(dPath);addrObj.SetPathToCanadaFiles(dPath);

If (addrObj.InitializeDataFiles() != 0) {InitErrorString = addrObj.GetInitializeErrorString();

} Else {InitErrorString = addrObj.GetInitializeErrorString();DatabaseDate = addrObj.GetDatabaseDate();ExpDate = addrObj.GetExpirationDate();BuildNum = addrObj.GetBuildNumber();

}

Step 5 — Lookup: Input Required for VerifyAddress FunctionThe minimum required input is a street address, plus either the city and state or the five-digit ZIP Code™. Company name may be necessary for an accurate ZIP + 4® in the case of business or other facility addresses that have their own unique nine-digit ZIP Code.

9

Page 13: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

VB.NETaddrObj.SetAddress("22382 Avenida Empresa")addrObj.SetZip("92688")addrObj.SetCompany("Melissa Data Corp")

C#.NETaddrObj.SetAddress("22382 Avenida Empresa");addrObj.SetZip("92688");addrObj.SetCompany("Melissa Data Corp");

Step 6 — Lookup: Calling the VerifyAddress FunctionIf the return value is false, then the address could not be properly coded.

VB.NETPrivate Result as BooleanResult = addrObj.VerifyAddress

C#.NETprivate bool Result = false;result = addrObj.VerifyAddress();

Step 7 — Processing: Checking the ResultsIf the VerifyAddress could not code the input address, you can check the reason by querying the return value of the GetResults function.

VB.NETResultCode = addrObj.GetResults

C#.NETprivate string resultCode = addrObj.GetResults();

The GetResults function replaces the GetStatusCode, GetErrorCode, GetErrorString, GetSuiteStatus and GetDPVFootnotes functions. Those functions should be considered deprecated going foward, but if your existing code requires that you continue to use these functions, GetStatusCode should be called first. If Address Object could not return a result, then the GetErrorCode function will give you additional information about the reason why the query failed. Both functions return text strings that are exactly one character long. GetErrorString returns a fuller description of the results returned by GetErrorCode.

Step 8 — Processing: Retrieving the ResultsThe VerifyAddress function populates return values of numerous functions, a few of which are illustrated in the example below. For a complete list of the values returned by the VerifyAddress function, see the Address Object Reference Guide.

VB.NETAddress1 = addrObj.GetAddressAddress2 = addrObj.GetAddress2Suite = addrObj.GetSuite

10

Page 14: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

City = addrObj.GetCityState = addrObj.GetStateZip = addrObj.GetZipPlus4 = addrObj.GetPlus4CountyName = addrObj.GetCountyName

C#.NETprivate string Address1 = addrObj.GetAddress();private string Address2 = addrObj.GetAddress2();private string Suite = addrObj.GetSuite();private string City = addrObj.GetCity();private string State = addrObj.GetState();private string Zip = addrObj.GetZip();private string Plus4 = addrObj.GetPlus4();private string CountyName = addrObj.GetCountyName();

These are just the basics. See the Data Quality Suite Reference Guide for information about all the information that Address Object can return.

Step 9 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Address Object leaks allocated resources, however, you must properly destroy Address Object to force the release of memory.

VB.NETaddrObj.Dispose()

C#.NETaddrObj.Dispose();

ADDRESS OBJECT SAMPLE — STREET DATA INTERFACEThe StreetData interface returns a list of all possible address ranges matching a specific street name or portion of a street name within a given ZIP Code. This is useful when VerifyAddress returns an error code for an address indicating that the address falls outside any known deliverable range. Rather than discarding the address as useless, you can attempt to match it against known ranges on the same street or similarly named streets in the same ZIP Code. This might give you a list of alternate possible addresses.

If you are using Address Object as part of your web application and a customer enters a bad address, or their address matches more than one record, StreetData enables you to catch it immediately and present the customer with the opportunity to select the correct address.

The FindStreet function accepts a full or partial street name ("MA*" for all streets beginning with the letters M-A) and a five-digit ZIP Code, like this:

Result = StreetData.FindStreet("Ash*", "92899")

This function would then return values filled with the first address range that matches that street name and ZIP Code, such as Ash Street and Ashland Avenue. The information returned includes the street name, the high and low values of the street number range, the high and low

11

Page 15: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

values of the Plus 4 portion of the ZIP Code, and the high and low values for the range of suite numbers, if any. FindStreet also returns indicators that show if the above numbers in the range are odd, even or both.

You could then use the IsAddressInRange2 function to determine if a specific address falls within that range. If not, you would then call the FindStreetNext function to return the next matching range, and compare the address to that range, repeating until you exhaust all possibilities.

Step 1 — Instantiation: Declaring and Creating an InstanceSee Step 1 above under the AddressCheck sample for information on adding Address Object to your project.

VB.NETDim StreetData As New MelissaData.mdStreet

C#.NETprivate mdStreet StreetData = New MelissaData.mdStreet;

Step 2 — Initialization: Set the License StringFollow the same process used in Step 3 under the AddressCheck interface above.

Step 3 — Initialization: Initialize the Data FilesStreetData uses a different initialization method than AddressCheck. The Initialize function calls for two string values containing the path to the Address Object’s data files named mdAddr.dat, mdAddr.nat, mdAddr.lic, and mdAddr.str.

There is a third, optional parameter that is no longer used. If your programming environment does not support optional parameters, pass an empty string to this function as a third parameter.

VB.NETPrivate Result As AddressObjectErrorCodesResult = StreetData.Initialize(DataPath, NationalPath)If Result <> 0 Then

Msgbox (StreetData.GetInitializeErrorString)End If

C#.NETAddressObjectErrorCodes Result = new AddressObjectErrorCodes;Result = StreetData.Initialize(DataPath, NationalPath);If Result != 0 {

Console.WriteLine (StreetData.GetInitializeErrorString());}

Step 4 — Lookup: Calling the FindStreet FunctionThe FindStreet function returns the first address range that matches the street name or partial name and ZIP Code passed as parameters.

12

Page 16: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

VB.NETPrivate Result as BooleanResult = StreetData.FindStreet(StreetName, ZipCode)

C#.NETbool Result = false;Result = StreetData.FindStreet(StreetName, ZipCode);

Step 5 — Processing: Calling the IsAddressInRange2 FunctionIf the FindStreet function finds a range which matches the street name and ZIP Code submitted, it returns values to several functions which can then be compared to specific address data to see if the address falls within the returned range.

The IsAddressInRange2 function compares a submitted value to a high and low value to see if the value falls within the range. The function can also exclude odd or even values. You can use this function as a backstop for VerifyAddress to check an address that could not be verified to find alternate possible addresses that might be valid.

VB.NETPrivate InRange As Boolean, High as String, Low As String, Odd As

String

Do While Result High = StreetData.GetPrimaryRangeHighLow = StreetData.GetPrimaryRangeLowOdd = StreetData.GetPrimaryRangeOddEvenInRange = StreetData.IsAddressInRange2(Range, High, Low, Odd)If InRange Then

Msgbox "Match found"End If

C#.NETbool InRange = false;string High = "";string Low = "";string Odd = "";

while Result {High = StreetData.GetPrimaryRangeHigh();Low = StreetData.GetPrimaryRangeLow();Odd = StreetData.GetPrimaryRangeOddEven();InRange = StreetData.IsAddressInRange2(Range, High, Low, Odd);if InRange {

Console.WriteLine("Match found");}

13

Page 17: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 6 — Lookup: Find the Next Match with FindStreetNextThe FindStreetNext function returns the next match to the pattern passed to the last call to the FindStreet function. If there are no more matches, the function returns a value of false. This allows you to loop through all possible street data matches and use the IsAddressInRange2 function to find any that might match your address. The complete structure might look something like the code below.

VB.NETResult = StreetData.FindStreetNext

Loop

C#.NETResult = StreetData.FindStreetNext();

}

Step 7 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Address Object leaks allocated resources, however, you must properly destroy your StreetData Object to force the release of memory.

VB.NETStreetData.Dispose()

C#.NETStreetData.Dispose();

ADDRESS OBJECT SAMPLE — ZIPDATA INTERFACEZIP Data interface returns both ZIP Code data based on city and state information and city/state information based on ZIP Code. Using the example of a web application processing customer addresses, this interface could be used in the event that the customer enters an unrecognized city, state or ZIP Code. After the VerifyAddress function catches errors, the ZipData functions can generate a list of cities or ZIP codes to be presented to the customers as alternatives to what they entered.

Step 1 — Instantiation: Declaring and Creating an InstanceSee Step 1 under the Address Check sample above for information on adding Address Object to your project.

VB.NETDim ZipData As New MelissaData.mdZip

C#.NETmdZip ZipData = New MelissaData.mdZip

Step 2 — Initialization: Set the License StringFollow the same process used in Step 3 under the AddressCheck interface above.

14

Page 18: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 3 — Initialization: Initialize the Data FilesZipData uses the same initialization functions as the Street Data interface. See Step 3 under StreetData for an example.

Step 4 — Lookup: Calling the FindZip FunctionThe FindZip function retrieves the first record found for the submitted five-digit ZIP Code, which includes city name, state, county information and geographical information, and populates the return value of the corresponding functions. Often there will be only one unless the ZIP Code covers more than one city or there is at least one alternative name for a city. If the record returned includes the official preferred city name, a function called GetLastLineIndicator will return the letter “L.” You can use this function to standardize your address data by using only the official city name.

The FindZipNext function retrieves the next record for the last call to FindZip, if any. If there is another record, this function returns true, false otherwise.

VB.NETPrivate Result As BooleanResult = ZipData.FindZip("92688")While Result

AreaCode = ZipData.GetAreaCodeAutomation = ZipData.GetAutomationCity = ZipData.GetCityState = ZipData.GetStateLat = ZipData.GetLatitudeLong = ZipData.GetLongitudeTZ = ZipData.GetTimeZoneTZCode = ZipData.GetTimeZoneCodeResult = ZipData.FindZipNext

Loop

C#.NETbool Result = false;Result = ZipData.FindZip("92688");While (Result) {

private string AreaCode = ZipData.GetAreaCode();private string Automation = ZipData.GetAutomation();private string City = ZipData.GetCity();private string State = ZipData.GetState();private string Latitude = ZipData.GetLatitude();private string Longitude = ZipData.GetLongitude();private string TZ = ZipData.GetTimeZone();private string TZCode = ZipData.GetTimeZoneCode();Result = ZipData.FindZipNext();

}

See the Data Quality Suite Reference Guide for a complete list of functions for retrieving the values returned by the different ZipData functions.

15

Page 19: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 5 — Lookup: Calling the FindZipInCity FunctionThe FindZipInCity functions similarly to FindZip, except that, along with FindZipInCityNext, it retrieves every five-digit ZIP Code associated with a given city and state, and populates the return values of the corresponding functions. This function allows you to expand your data by easily associating records found in the same city.

The FindZipInCityNext function retrieves the next record for the last call to FindZipInCity, if any. If there is another record, this function returns true, false otherwise.

VB.NETPrivate Result As BooleanResult = ZipData.FindZipInCity("Rancho Santa Margarita", "CA")While Result

Automation = ZipData.GetAutomationCity = ZipData.GetCityState = ZipData.GetStateLat = ZipData.GetLatitudeLong = ZipData.GetLongitudeTZ = ZipData.GetTimeZoneTZCode = ZipData.GetTimeZoneCodeResult = ZipData.FindZipInCityNext

Loop

C#.NETbool Result = falseResult = ZipData.FindZipInCity("Rancho Santa Margarita", "CA");While (Result) {

private string Automation = ZipData.GetAutomation();private string City = ZipData.GetCity();private string State = ZipData.GetState();private string Latitude = ZipData.GetLatitude();private string Longitude = ZipData.GetLongitude();private string TZ = ZipData.GetTimeZone();private string TZCode = ZipData.GetTimeZoneCode();Result = ZipData.FindZipInCityNext();

}

See the Data Quality Suite Reference Guide for a complete list of the different ZipData functions.

Step 6 — Lookup: Calling the FindCityInState FunctionThe FindCityInState function returns the first city name and state found that matches a partial or whole city name and state. For example, passing both “Los A*” and “CA” to this function would return “Los Angeles,” “Los Alamitos” and “Los Altos,” among others. You might use this with a web application if a customer enters an unrecogized city name. Pass the state and first letter or two of the city name to FindCityInState to present alternatives for the customer to select.

16

Page 20: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

A successful call to each ZipData function populates the return values for a series of functions with the associated data. For example, the following code would retrieve the results for a call to the FindCitiesInState function.

The FindCityInStateNext function retrieves the next record for the last call to FindCityInState, if any. If there is another record, this function returns true, false otherwise.

VB.NETResult = ZipData.FindCityInState("Rancho*", "CA")While Result

City = ZipData.GetCityAbbrev = ZipData.GetCityAbbreviationState = ZipData.GetStateResult = ZipData.FindCityInStateNext

Loop

C#.NETbool Result = ZipData.FindCityInState("Rancho*", "CA");While (Result) {

private string City = ZipData.GetCity();private string Abbrev = ZipData.GetCityAbbreviation();private string State = ZipData.GetState();private string Result = ZipData.FindCityInStateNext();

}

Step 7 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Address Object leaks allocated resources, however, you should properly destroy any instance of the ZipData interface to force the release of memory.

VB.NETZipData.Dispose()

C#.NETZipData.Dispose();

ADDRESS OBJECT SAMPLE — PARSE INTERFACE

Step 1 — Instantiation: Declaring and Creating an InstanceSee Step 1 under the Address Check sample above for information on adding Address Object to your project.

VB.NETDim Parser As New MelissaData.mdParsePrivate Result As BooleanPrivate dPath As StringdPath = "C:/Program Files/Melissa Data/DQT/Data Files"Result = Parser.Initialize(dPath)

17

Page 21: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

C#.NETmdParse Parser = New MelissaData.mdParse;bool Result = false;string dPath = "C:\\Program Files\\Melissa Data\\DQT\\Data

Files";Result = Parser.Initialize(dPath);

Step 2 — Lookup: Calling the Parse FunctionThe Parse function only requires you to pass a string value containing the address to be parsed as a parameter. This function will always attempt to parse the data passed to it and does not return any error code.

VB.NETParser.Parse(StreetAddress)

C#.NETParser.Parse(StreetAddress);

Step 3 — ProcessingThe Parse function then populates the return values for several functions with the separate parts of the parsed address. These are PostDirection, PreDirection, PrivateMailboxName, PrivateMailboxNumber, Range, StreetName, Suffix, SuiteName and SuiteNumber.

ParseNext retrieves an alternative parsing of the address passed to the most recent call to the Parse function. If no more possibilities are found, the function returns a false value, otherwise it returns a true and populates the return values of the same functions that the Parse function populates.

VB.NETPrivate Proceed As BooleanProceed = True

Do While Proceed = TrueRange = Parser.GetRangePreDir = Parser.GetPreDirectionStreetName = Parser.GetStreetNameSuffix = Parser.GetSuffixPostDir = Parser.GetPostDirectionSuiteName = Parser.GetSuiteNameSuiteNumber = Parser.GetSuiteNumberPMBName = Parser.GetPrivateMailBoxNamePMBNumber = Parser.GetPrivateMailBoxNumber

Proceed = Parser.ParseNextLoop

C#.NETbool Proceed = true

18

Page 22: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

while (Proceed) {Range = Parser.GetRange();private string PreDir = Parser.GetPreDirection();private string StreetName = Parser.GetStreetName();private string Suffix = Parser.GetSuffix();private string PostDir = Parser.GetPostDirection();private string SuiteName = Parser.GetSuiteName();private string SuiteNumber = Parser.GetSuiteNumber();private string PMBName = Parser.GetPrivateMailBoxName();private string PMBNumber = Parser.GetPrivateMailBoxNumber();

Proceed = Parser.ParseNext();}

Step 4 — Lookup: Parsing Last Line InformationThe LastLineParse function will break up a single string containing city, state and ZIP Code information. This is useful if your address information comes to you as lines of text rather than individual values.

VB.NETPrivate LastLine As StringLastLine = "Rancho Santa Margarita, CA 92688-2112"Parser.LastLineParse(LastLine)City = Parser.GetCityState = Parser.GetStateZip = Parser.GetZipPlus4 = Parser.GetPlus4

C#.NETprivate string LastLine = "Rancho Santa Margarita, CA 92688-

2112";Parser.LastLineParse(LastLine);private string City = Parser.GetCity();private string State = Parser.GetState();private string Zip = Parser.GetZip();private string Plus4 = Parser.GetPlus4();

Step 5 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Address Object leaks allocated resources, however, you must properly destroy Address Object to force the release of memory.

VB.NETParser.Dispose()

C#.NETParser.Dispose();

19

Page 23: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

PHONE OBJECT SAMPLEThe Phone Object retrieves geographic information based on a submitted phone number and also parses out the area code and prefix from the phone number. This includes longitude, latitude, county, and demographic area information based on the centroid of the area code/prefix combination.

Being able to sort records by area code, telephone prefix or both gives you additional tools to get more value out of your contact data.

In order to use the .NET wrapper, you will need to copy two DLL files from the Data Quality Suite DVD to a local folder. These files, mdPhoneNET.dll and mdPhoneCS.dll are located in the phone\windows\interfaces\net folder. Copy the files to a location inside your project folder.

The .NET wrapper must be able to find the Phone Object’s standard DLL file, mdPhone.dll. The simplest method is to copy this file from the installed location, normally “C:\Program Files\Melissa DATA\DQT\PhoneObj,” to the same folder that contains mdPhoneNET.dll and mdPhoneCS.dll.

Step 1 — Instantiation: Declaring and Creating an InstanceEvery Visual Basic project that uses an external .NET component has to start with a project reference. See the procedure for the adding a reference to Address Object. The Phone Object file is named mdPhoneNET.dll.

Step 2 — Initialization: Create an Instance of Phone ObjectBegin by declaring the object as a new object variable.

VB.NETPrivate phoneObject As New MelissaData.mdPhone

C#.NETmdPhone phoneObject = New MelissaData.mdPhone

Step 3 — Initialization: Setting the License StringCall the SetLicenseString function for Phone Object to retrieve the license string from the MDPHONE_LICENSE environment variable.

VB.NETphoneObj.SetLicenseString ("")

C#.NETphoneObj.SetLicenseString ("");

Step 4 — Initialization: Initialize the Data FilesThe Initialize function requires a string value containing the path to Phone Object’s data files.

VB.NETPrivate Result As DataBaseErrResult = phoneObj.Initialize(DataPath)

20

Page 24: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

If Result <> 0 ThenMsgbox (phoneObj.GetInitializeErrorString)

End If

C#.NETDataBaseErr Result = phoneObj.Initialize(DataPath);If (Result != 0) {

Console.WriteLine (phoneObj.GetInitializeErrorString);}

Step 5 — Lookup: Calling the Lookup FunctionThe Lookup function accepts a string containing a phone number and populates the return values of several functions if it successfully locates the area code and prefix in the database.

VB.NETDim Result As BooleanResult = phoneObj.Lookup("949-589-5200", "92688")

C#.NETbool Result = false;result = phoneObj.Lookup("949-589-5200", "92688");

If the Lookup function returns a false value, an error has occurred. Check the GetErrorCode and GetStatusCode functions to determine the cause.

Step 6 — Processing: Retrieve the Return ValuesA successful call to the Lookup function populates the return values of the functions listed below. The functions return string values. If you need to perform any calculations, you will need to convert numbers to the correct data type.

VB.NETAreaCode = phoneObj.GetAreaCodePrefix = phoneObj.GetPrefixSuffix = phoneObj.GetSuffixExt = phoneObj.GetExtensionCity = phoneObj.GetCityCountry = phoneObj.GetCountryCodeFips = phoneObj.GetCountyFipsCounty = phoneObj.GetCountyNameLat = phoneObj.GetLatitudeLong = phoneObj.GetLongitudeState = phoneObj.GetStateTimeZone = phoneObj.GetTimeZoneTimeZoneCode = phoneObj.GetTimeZoneCode

C#.NETprivate string AreaCode = phoneObj.GetAreaCode();private string Prefix = phoneObj.GetPrefix();private string Suffix = phoneObj.GetSuffix();

21

Page 25: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

private string Ext = phoneObj.GetExtension();private string City = phoneObj.GetCity();private string Country = phoneObj.GetCountryCode();private string Fips = phoneObj.GetCountyFips();private string County = phoneObj.GetCountyName();private string Latitude = phoneObj.GetLatitude();private string Longitude = phoneObj.GetLongitude();private string State = phoneObj.GetState();private string TimeZone = phoneObj.GetTimeZone();private string TimeZoneCode = phoneObj.GetTimeZoneCode();

Step 7 — Processing: Correcting Area CodesPhone Object also includes a CorrectAreaCode function, which checks the submitted phone number against a database of recently updated area codes and retrieves the new area code. The function then populates the GetAreaCode and GetNewAreaCode functions. If there has been an area code split, the updated area code will be passed to the GetNewAreaCode function. If there has been no change, the return values of both functions will be the same.

VB.NETResult = phoneObj.CorrectAreaCode("949-589-5200", "92688")If Result Then

AreaCode = phoneObj.GetAreaCodeNewAreaCode = phoneObj.GetNewAreaCode

ElseResults = phoneObj.GetResults

End If

C#.NETbool Result = phoneObj.CorrectAreaCode("949-589-5200", "92688");If (Result) {

private string AreaCode = phoneObj.GetAreaCode();private string NewAreaCode = phoneObj.GetNewAreaCode();

} else {private string Results = phoneObj.GetResults();

}

Step 8 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Phone Object leaks allocated resources, however, you must properly destroy any instance of Phone Object to force the release of memory.

VB.NETphoneObj.Dispose()

C#.NETphoneObj.Dispose();

22

Page 26: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

NAME OBJECT SAMPLEMelissa Data’s Name Object takes a person’s full name and parses it into first, middle and last. It can also recognize titles and honorifics such as “Ms.” or “Dr.”, as well as generational and educational suffixes like “Jr.” or “MD.” Name Object can, in many cases, recognize the gender of the first name and can also flag names containing possible vulgarities, screening out hoaxes or other bad data. This object enables you to sort by last name if your data comes to you with the contact name contained in a single string value. The ability to “genderize” your name data allows you to more accurately target direct mail advertising even when the customer did not supply gender information.

In order to use the .NET wrapper, you will need to copy two DLL files from the Data Quality Suite DVD to a local folder. These files, mdNameNET.dll and mdNameCS.dll are located in the name\windows\interfaces\net folder. Copy the files to a location inside your project folder.

The .NET wrapper must be able to find the Name Object’s standard DLL file, mdName.dll. The simplest method is to copy this file from the installed location, normally “C:\Program Files\Melissa DATA\DQT\NameObj,” to the same folder that contains mdNameNET.dll and mdNameCS.dll.

Step 1 — Instantiation: Declaring and Creating an InstanceEvery Visual Basic project that uses an external .NET component has to start with a project reference. See the procedure for adding a reference to Address Object. The Name Object file is named mdNameNET.dll.

Step 2 — Initialization: Create an Instance of Name ObjectBegin by declaring the object as a new object variable.

VB.NETDim nameObj As New MelissaData.mdName

C#.NETmdName nameObj = New MelissaData.mdName;

Step 3 — Initialization: Setting the License StringCall the SetLicenseString function for Name Object to retrieve the license string from the MDNAME_LICENSE environment variable.

VB.NETnameObj.SetLicenseString ("")

C#.NETnameObj.SetLicenseString ("");

Step 4 — Initialization: Initialize the Data FilesBefore initializing the data files, you must call the SetPathToNameFiles function using a string containing the path to the mdName data files.

23

Page 27: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

VB.NETnameObj.SetPathToNameFiles(strDataPath)Result = nameObj.InitializeDataFiles()If Result <> 0 Then

Msgbox nameObj.GetInitializeErrorStringEnd If

C#.NETnameObj.SetPathToNameFiles(strDataPath);Result = nameObj.InitializeDataFiles()If (Result != 0) {

Console.WriteLine(nameObj.GetInitializeErrorString);}

Step 5 — Lookup: Set the Name Object OptionsThe Name Object has several optional settings that control how the object genderizes names, builds salutations, and handles misspelled first names. The following lines show the default settings. See the Name Object Reference Guide for detailed information on each setting.

VB.NETnameObj.SetFirstNameSpellingCorrection(1)nameObj.SetGenderPopulation(1)nameObj.SetGenderAggression(1)nameObj.AddSalutation(Formal)nameObj.AddSalutation(FirstLast)nameObj.AddSalutation(Informal)nameObj.AddSalutation(Slug)nameObj.SetSalutationPrefix("Dear")nameObj.SetSalutationSuffix(";")nameObj.SalutationSlug("Valued Customer")nameObj.PrimaryNameHint(4)

C#.NETnameObj.SetFirstNameSpellingCorrection(1);nameObj.SetGenderPopulation(1);nameObj.SetGenderAggression(1);nameObj.AddSalutation(Formal);nameObj.AddSalutation(FirstLast);nameObj.AddSalutation(Informal);nameObj.AddSalutation(Slug);nameObj.SetSalutationPrefix("Dear");nameObj.SetSalutationSuffix(";");nameObj.SalutationSlug("Valued Customer");nameObj.PrimaryNameHint(4);

24

Page 28: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 6 — Lookup: Calling the Parse FunctionThe Parse function accepts a single string value containing a full name. Ideally, this name should be formatted as first name, middle name, and last name. Name Object can handle last name first if the string is properly formatted and punctuated (last name, comma, first name and middle name) or if PrimaryNameHint is set to handle an inverse name.

VB.NETnameObj.SetFullName("Mr. John J. Smith, Jr. and Mrs. Mary Q.

Jones")nameObj.Parse

C#.NETnameObj.SetFullName("Mr. John J. Smith, Jr. and Mrs. Mary Q.

Jones");nameObj.Parse();

Step 7 — Processing: Retrieving the Parsed NameA successful call to the Parse function populates the return values of the following functions: FirstName (“John”), MiddleName (“J”), LastName (“Smith”), Prefix (“Mr.”), Suffix (“Jr”) and Gender (“M”). If a second full name was present, Name Object also populates the values for a second set of functions: FirstName2 (“Mary”), MiddleName2 (“Q”), LastName2 (“Jones”), Prefix2 (“Mrs.”), Suffix2 (empty in this case) and Gender2 (“F”).

The object also sets the return value of the GetSalutation function using the first name found in the full name, if more than one was present (“Dear Mr. Smith;”)

VB.NETFirstName = nameObj.GetFirstNameMiddleName = nameObj.GetMiddleNameLastName = nameObj.GetLastNamePrefix = nameObj.GetPrefixSuffix = nameObj.GetSuffixGender = nameObj.GetGenderFirstName2 = nameObj.GetFirstName2MiddleName2 = nameObj.GetMiddleName2LastName2 = nameObj.GetLastName2Prefix2 = nameObj.GetPrefix2Suffix2 = nameObj.GetSuffix2Gender2 = nameObj.GetGender2Salutation = nameObj.GetSalutation

C#.NETprivate string FirstName = nameObj.GetFirstName();private string MiddleName = nameObj.GetMiddleName();private string LastName = nameObj.GetLastName();private string Prefix = nameObj.GetPrefix();private string Suffix = nameObj.GetSuffix();private string Gender = nameObj.GetGender();

25

Page 29: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

private string FirstName2 = nameObj.GetFirstName2();private string MiddleName2 = nameObj.GetMiddleName2();private string LastName2 = nameObj.GetLastName2();private string Prefix2 = nameObj.GetPrefix2();private string Suffix2 = nameObj.GetSuffix2();private string Gender2 = nameObj.GetGender2();private string Salutation = nameObj.GetSalutation();

Step 8 — Processing: Check The ResultsCheck the output of the GetResults function to determine the degree of success and any problems with Parsing or Genderizing.

If First Name Spelling Correction was enabled, the results codes will also indicate if one or both first names were corrected.

VB.NETPrivate ResultsOut As String, Result As StringResult = nameObj.GetResultsResultsOut = ""If (Result.Contains("NS01")) Then ResultsOut += "NS01: There were

no errors. \r\n"If (Result.Contains("NS03")) Then ResultsOut += "NS03: The

spelling of the FirstName field was corrected. \r\n"If (Result.Contains("NS04")) Then ResultsOut += "NS04: The

spelling of the FirstName2 field was corrected. \r\n"If (Result.Contains("NS02")) Then ResultsOut += "NS02: A Parse

Error was found.... \r\n"If (Result.Contains("NE01")) Then ResultsOut += "NE01: Two names

were detected but the FullName string was not in a recognized format \r\n"

If (Result.Contains("NE02")) Then ResultsOut += "NE02: Multiple first names - could not accurately genderize \r\n"

If (Result.Contains("NE03")) Then ResultsOut += "NE03: A vulgarity was detected in the name \r\n"

If (Result.Contains("NE04")) Then ResultsOut += "NE04: A nuisance name [such as Mickey Mouse] was detected in the name \r\n"

If (Result.Contains("NE05")) Then ResultsOut += "NE05: The name contained words normally found in a company name \r\n"

If (Result.Contains("NE06")) Then ResultsOut += "NE06: The name contained a non-alphabetic character \r\n"

Print ResultsOut

C#.NETstring Result = nameObj.GetResults();string ResultsOut = "";If (Result.Contains("NS01")) ResultsOut += "NS01: There were no

errors. \r\n";

26

Page 30: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

If (Result.Contains("NS03")) ResultsOut += "NS03: The spelling of the FirstName field was corrected. \r\n";

If (Result.Contains("NS04")) ResultsOut += "NS04: The spelling of the FirstName2 field was corrected. \r\n";

If (Result.Contains("NS02")) ResultsOut += "NS02: A Parse Error was found.... \r\n";

If (Result.Contains("NE01")) ResultsOut += "NE01: Two names were detected but the FullName string was not in a recognized format \r\n";

If (Result.Contains("NE02")) ResultsOut += "NE02: Multiple first names - could not accurately genderize \r\n";

If (Result.Contains("NE03")) ResultsOut += "NE03: A vulgarity was detected in the name \r\n";

If (Result.Contains("NE04")) ResultsOut += "NE04: A nuisance name [such as Mickey Mouse] was detected in the name \r\n";

If (Result.Contains("NE05")) ResultsOut += "NE05: The name contained words normally found in a company name \r\n";

If (Result.Contains("NE06")) ResultsOut += "NE06: The name contained a non-alphabetic character \r\n";

Console.WriteLine(ResultsOut);

Step 9 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Name Object leaks allocated resources, however, you must properly destroy Name Object to force the release of memory.

VB.NETnameObj.Dispose()

C#.NETnameObj.Dispose();

EMAIL OBJECT SAMPLEIn order to use the .NET wrapper, you will need to copy two DLL files from the Data Quality Suite DVD to a local folder. These files, mdNameNET.dll and mdEmailCS.dll are located in the name\windows\interfaces\net folder. Copy the files to a location inside your project folder.

The .NET wrapper must be able to find the Name Object’s standard DLL file, mdEmail.dll. The simplest method is to copy this file from the installed location, normally “C:\Program Files\Melissa DATA\DQT\EmailObj,” to the same folder that contains mdEmailNET.dll and mdEmailCS.dll.

27

Page 31: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

Step 1 — Instantiation: Declaring and Creating an InstanceEvery Visual Basic project that uses an external .NET component has to start with a project reference. See the procedure for the adding a reference to Address Object. The Email Object file is named mdEmaileNET.dll.

Step 2 — Initialization: Create an Instance of Email ObjectBegin by declaring the object as a new object variable.

VB.NETDim emailObj as New MelissaData.mdEmail

C#.NETmdEmail emailObj = New MelissaData.mdEmail;

Step 3 — Initialization: Setting the License String and Data PathCall the SetLicenseString function for Email Object to retrieve the license string from the MDEMAIL_LICENSE environment variable.

VB.NETemailObj.SetLicenseString("")

C#.NETemailObj.SetLicenseString("");

Step 4 — Initialization: Initializing the Data FilesInitialializing connects Email Object to its data files. If it does not initialize, then display the GetInitializeErrorString for an explanation of the error.

VB.NETemailObj.SetPathToEmailFiles(DataPath)If (emailObj.InitializeDataFiles() <> 0) Then

MsgBox emailObj.GetInitializeErrorString()End If

C#.NETemailObj.SetPathToEmailFiles(DataPath);If (emailObj.InitializeDataFiles() != 0) {

Console.WriteLine(emailObj.GetInitializeErrorString());}

Step 5 — Initialization: Setting the Verification OptionsEmail Object has five boolean functions to enable or disable certain options before verifying an email address. For more information on these functions, see the Data Quality Suite Reference Guide.

VB.NETemailObj.SetCorrectSyntax(True)emailObj.SetDatabaseLookup(True)emailObj.SetMXLookup(True)

28

Page 32: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

emailObj.SetStandardizeCasing(True)emailObj.SetUpdateDomain(True)

C#.NETemailObj.SetCorrectSyntax(True);emailObj.SetDatabaseLookup(True);emailObj.SetMXLookup(True);emailObj.SetStandardizeCasing(True);emailObj.SetUpdateDomain(True);

Step 6 — Processing: Verifying the Email AddressVerifying the email address is simply a matter of passing the email address to the VerifyEmail function, which returns a boolean true if successful. You can then extract the various parts of the standardized address using the functions shown below.

The GetChangeCode function returns a number that can be used to check what has been changed. Use the AND operator to check the first four bits.

If the VerifyEmail function cannot verify the submitted email address, Email Object returns the Error and Status Codes to reveal the reason why the address could not be successfully verified.

VB.NETIf emailObj.VerifyEmail(InputEmail) = True Then

Mailbox = emailObj.GetMailBoxNameTLD = emailObj.GetTopLevelDomainTLDDesc = emailObj.GetTopLevelDomainDescriptionEmailAddress = emailObj.GetEmailAddressDomain = emailObj.GetDomainNamePrivate ChangeList As String = ""Private ChangeCode As IntegerChangeCode = emailObj.GetChangeCodeIf ((ChangeCode And 1) = 1) Then

ChangeList += "Syntax Changed" + vbNewLineEnd IfIf ((ChangeCode And 2) = 2) Then

ChangeList += "TLD Updated" + vbNewLineEnd IfIf ((ChangeCode And 4) = 4) Then

ChangeList += "Domain Spelling" + vbNewLineEnd IfIf ((ChangeCode And 8) = 8) Then

ChangeList += "Domain Updated" + vbNewLineEnd If

ElseStatus = emailObj.GetStatusCodeErrCode = emailObj.GetErrorCodeErrDesc = emailObj.GetErrorString

End If

29

Page 33: Address Object EmailObject NameObject PhoneObjectwiki.melissadata.com/images/3/31/DQT_API_DQSNet_QSG.pdfname information (Salutation uses the first person’s name if two full names

C#.NETIf (emailObj.VerifyEmail(InputEmail)) {

string Mailbox = emailObj.GetMailBoxName();string TLD = emailObj.GetTopLevelDomain();string TLDDesc = emailObj.GetTopLevelDomainDescription();string EmailAddress = emailObj.GetEmailAddress();string Domain = emailObj.GetDomainName();

string ChangeList = "";int ChangeCode = emailObj.GetChangeCode;If ((ChangeCode And 1) = 1) {

ChangeList += "Syntax Changed" + vbNewLine;}If ((ChangeCode And 2) = 2) {

ChangeList += "TLD Updated" + vbNewLine;}If ((ChangeCode And 4) = 4) {

ChangeList += "Domain Spelling" + vbNewLine;}If ((ChangeCode And 8) = 8) {

ChangeList += "Domain Updated" + vbNewLine;}

} else {string Status = emailObj.GetStatusCode();string ErrCode = emailObj.GetErrorCode();string ErrDesc = emailObj.GetErrorString();

}

Step 7 — Termination: Destroying the InstanceBe sure to recycle your memory bits. We do not believe Email Object leaks allocated resources, however, you must properly destroy this instance of Email Object to force the release of memory.

VB.NETemailObj.Dispose()

C#.NETemailObj.Dispose();

30