Quickstart#

Introduction#

Address Object corrects, verifies and enhances U.S. and Canadian addresses.

Use Address Object to remove bad or 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 marketing campaigns.

Sample Code#

Address Object is compatible with multiple coding languages across different systems. The table below will link you to the sample code for each language hosted in the github repositories.

Language

System

Repository

C# .NET

Windows

melissa_favicon MelissaData/AddressObject-Dotnet

Linux

melissa_favicon MelissaData/AddressObject-Dotnet-Linux

melissa_favicon MelissaData/AddressObject-Dotnet-Wrappers

C++

Windows

melissa_favicon MelissaData/AddressObject-Cpp

Linux

melissa_favicon MelissaData/AddressObject-Cpp-Linux

Java

Windows

melissa_favicon MelissaData/AddressObject-Java

Linux

melissa_favicon MelissaData/AddressObject-Java-Linux

melissa_favicon MelissaData/AddressObject-Java-Wrappers

Python3

Windows

melissa_favicon MelissaData/AddressObject-Python3

Linux

melissa_favicon MelissaData/AddressObject-Python3-Linux

melissa_favicon MelissaData/AddressObject-Python3-Wrappers

How To Get Data#

Use the Melissa Updater to download the data files using the manifest named dq_addr_data.

Best Practices#

Basic Flow of Actions#

To use the AddressObject, you can give it a license, data path, and address. It will then analyze the address and store relevant information about it. It can also return result codes based on the validity of the address.

This is the flow of how Address Object is usually implemented:

The Reference Guide goes into detail on every method available with the Address Object. All the Result Codes and descriptions are also in the reference guide.

1. Initialize Address Object#

Start by creating an instance of the Melissa Address Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
 // Create instance of Melissa Address Object
public mdAddr mdAddressObj = new mdAddr();
// Create instance of Melissa Address Object
mdAddr* mdAddressObj = new mdAddr;
// Create instance of Melissa Phone Object
mdAddr mdAddressObj = new mdAddr();
# Create instance of Melissa Address Object
md_address_obj = mdAddr_pythoncode.mdAddr()

2. Set a License#

To set a license, either configure the environmental variable for the license or use the method SetLicenseString.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set license string
mdAddressObj.SetLicenseString(MELISSA_LICENSE_STRING);
// Set license string
    mdAddressObj->SetLicenseString(MELISSA_LICENSE_STRING.c_str());
// Set license string
    mdAddressObj.SetLicenseString(MELISSA_LICENSE_STRING");
# Set license string
md_address_obj.SetLicenseString(MELISSA_LICENSE_STRING)

To see when the license will expire, use the method GetLicenseExpirationDate.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
Console.WriteLine($"Expiration Date: {mdAddressObj.GetLicenseStringExpirationDate()}");
cout << "Expiration Date: " + string(mdAddressObj->GetLicenseStringExpirationDate()) << endl;
System.out.println("Expiration Date: " + mdAddressObj.GetLicenseStringExpirationDate());
print(f"Expiration Date: {md_address_obj.GetLicenseStringExpirationDate()}")

3. Initialize Data Files#

To set the path for the data files, use the following methods:

Use the method InitializeDataFiles to setup the data files.

ProgramStatus can be used to store the result from InitializeDataFiles to ensure it worked as expected.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// Set path to data files (.dat, etc)
mdAddressObj.SetPathToUSFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToAddrKeyDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToDPVDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToLACSLinkDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToRBDIFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToSuiteFinderDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToSuiteLinkDataFiles(PATH_TO_DATA_FILES);

mdAddr.ProgramStatus pStatus = mdAddressObj.InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdAddr.ProgramStatus.ErrorNone)
{
    Console.WriteLine("Failed to Initialize Object.");
    Console.WriteLine(pStatus);
    return;
}
// Set path to datafiles (.dat, etc)
mdAddressObj->SetPathToUSFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToAddrKeyDataFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToDPVDataFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToLACSLinkDataFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToRBDIFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToSuiteFinderDataFiles(PATH_TO_DATA_FILES.c_str());
mdAddressObj->SetPathToSuiteLinkDataFiles(PATH_TO_DATA_FILES.c_str());

mdAddr::ProgramStatus pStatus = mdAddressObj->InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdAddr::ProgramStatus::ErrorNone)
{
    cout << "Failed to Initialize Object." << endl;
    cout << pStatus << endl;
    return;
}
// Set path to data files (.dat, etc)
mdAddressObj.SetPathToUSFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToAddrKeyDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToDPVDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToLACSLinkDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToRBDIFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToSuiteFinderDataFiles(PATH_TO_DATA_FILES);
mdAddressObj.SetPathToSuiteLinkDataFiles(PATH_TO_DATA_FILES);

mdAddr.ProgramStatus pStatus = mdAddressObj.InitializeDataFiles();

// If an issue occurred while initializing the data files, this will throw
if (pStatus != mdAddr.ProgramStatus.ErrorNone) {
    System.out.println("Failed to Initialize Object.");
    System.out.println(pStatus);
    return;
}
# Set path to data files  (.dat, etc)
md_address_obj.SetPathToUSFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToAddrKeyDataFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToDPVDataFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToLACSLinkDataFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToRBDIFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToSuiteFinderDataFiles(PATH_TO_DATA_FILES)
md_address_obj.SetPathToSuiteLinkDataFiles(PATH_TO_DATA_FILES)

p_status = md_address_obj.InitializeDataFiles()

# If an issue occurred while initializing the data files, this will throw
if (p_status != mdAddr_pythoncode.ProgramStatus.ErrorNone):
    print("Failed to Initialize Object.")
    print(p_status)
    return

To check at what date the database was updated, use the method GetDatabaseDate.

Use the method GetBuildNumber to get the development build number of Global Address Object.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
// If you see a different date than expected, check your license string and either download
// the new data files or use the Melissa Updater program to update your data files.
Console.WriteLine($"DataBase Date: {mdAddressObj.GetDatabaseDate()}");

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
Console.WriteLine($"Object Version: {mdAddressObj.GetBuildNumber()}\n");
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
cout << "DataBase Date: " + string(mdAddressObj->GetDatabaseDate()) << endl;

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
cout << "Object Version: " + string(mdAddressObj->GetBuildNumber()) << endl;
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
System.out.println("DataBase Date: " + mdAddressObj.GetDatabaseDate());

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
System.out.println("Object Version: " + mdAddressObj.GetBuildNumber());
# If you see a different date than expected, check your license string and either download
# the new data files or use the Melissa Updater program to update your data files.
print(f"DataBase Date: {md_address_obj.GetDatabaseDate()}")

# This number should match with file properties of the Melissa Object binary file.
# If TEST appears with the build number, there may be a license key issue.
print(f"Object Version: {md_address_obj.GetBuildNumber()}\n")

The method GetInitializeErrorString can get the status on errors in initialization. This can help determine if the code should continue running.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
bool shouldContinueRunning = true;

if (mdAddressObj.GetInitializeErrorString() != "No error.")
{
    shouldContinueRunning = false;
}
bool shouldContinueRunning = true;

if (string(mdAddressObj->GetInitializeErrorString()) != "No error.")
{
    shouldContinueRunning = false;
}
Boolean shouldContinueRunning = true;

if (!mdAddressObj.GetInitializeErrorString().equals("No error."))
    shouldContinueRunning = false;
should_continue_running = True

if md_address_obj.GetInitializeErrorString() != "No error.":
    should_continue_running = False

4. Look Up and Verify the Address#

To set or clear the address for lookup, use the following functions:

The method VerifyAddress can verify the address that was set with the previous functions.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdAddressObj.ClearProperties();

mdAddressObj.SetAddress(ADDRESS_STRING);
mdAddressObj.SetCity(CITY_STRING);
mdAddressObj.SetState(STATE_STRING);
mdAddressObj.SetZip(ZIP_STRING);

mdAddressObj.VerifyAddress();
mdAddressObj->ClearProperties();

mdAddressObj->SetAddress(ADDRESS_STRING);
mdAddressObj->SetCity(CITY_STRING);
mdAddressObj->SetState(STATE_STRING);
mdAddressObj->SetZip(ZIP_STRING);

mdAddressObj->VerifyAddress();
mdAddressObj.ClearProperties();

mdAddressObj.SetAddress(ADDRESS_STRING);
mdAddressObj.SetCity(CITY_STRING);
mdAddressObj.SetState(STATE_STRING);
mdAddressObj.SetZip(ZIP_STRING);

mdAddressObj.VerifyAddress();
md_address_obj.ClearProperties()

md_address_obj.SetAddress(ADDRESS_STRING)
md_address_obj.SetCity(CITY_STRING)
md_address_obj.SetState(STATE_STRING)
md_address_obj.SetZip(ZIP_STRING)

md_address_obj.VerifyAddress()

5. Get Address Object information#

The following methods can get specific data fields from the address:

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdAddressObj.GetMelissaAddressKey();
mdAddressObj.GetAddress();
mdAddressObj.GetAddress2();
mdAddressObj.GetCity();
mdAddressObj.GetState();
mdAddressObj.GetZip();
mdAddressObj->GetMelissaAddressKey();
mdAddressObj->GetAddress();
mdAddressObj->GetAddress2();
mdAddressObj->GetCity();
mdAddressObj->GetState();
mdAddressObj->GetZip();
mdAddressObj.GetMelissaAddressKey();
mdAddressObj.GetAddress();
mdAddressObj.GetAddress2();
mdAddressObj.GetCity();
mdAddressObj.GetState();
mdAddressObj.GetZip();
md_address_obj.GetMelissaAddressKey()
md_address_obj.GetAddress()
md_address_obj.GetAddress2()
md_address_obj.GetCity()
md_address_obj.GetState()
md_address_obj.GetZip()

6. Get the Melissa Result Codes#

In order to get the result codes, call the method GetResults. This will return all of the result codes stacked together in a single String separated by ‘,’ delimiters.

Example Implementation:

  • C#
  • C++
  • Java
  • Python3
mdAddressObj.GetResults();
mdAddressObj->GetResults();
mdAddressObj.GetResults();
md_address_obj.GetResults()