Click or drag to resize
Address data type
Print this page

The data type Address represents a complete address and geographic location and is made up of the subfields described below. When you work with columns that have the Address data type, you have the option to either work with the full address as a string or with the individual subfields that make up an address.

Address geocoding

When an address data type is created, it will try to fill out all of the details of the address and geographic location that were not explicitly provided by using the data that was provided and the following geocoding rules:

  • If you only provide the address as a string, then the string provided is geocoded and the following subfields are filled out: StreetNumber, StreetName, City, Region, PostalCode, Country, Coordinates.Lat, and Coordinates.Lon.
  • If you only provide the address subfields, then these are geocoded to fill out the Coordinates.Lat and Coordinates.Lon subfields.
  • If you only provide Coordinates.Lat and Coordinates.Lon, then the Lat and Lon are used to reverse geocode the address and fill out the other address subfields. Reverse geocoding finds the nearest street to the given location and calculates the street number using the nearest point on the street.
  • If you provide a combination of a string address and other address subfields, then the behavior depends on which fields are provided. If the string address and all address subfields are provided, then the address is geocoded using the address subfields. If the string address is provided along with a partial set of the address subfields, then the address is geocoded using the string address, and the partial address subfields provided override the geocode results.
Address string input

To provide the address as a string within an input template, use the format shown below. If you do not include a country in your address input ("address[ -- country]"), then the country defaults to USA.

  • US address example:
    "3110 Esperanza Crossing, Austin, TX 78741"
  • Canadian address example:
    "2000 Airport Rd NE Calgary, AB T2E 6Z8 -- Canada"
  • Australian address example that includes a Suburb (Richmond):
    "11 Albert Street, Richmond, VIC 3121 -- Australia"
Subfields

Instead of inputting or outputting the full address as a string, you also have the option to work with the individual subfields that make up an address (for example, Address.City). For more information about working with subfields, see Accessing subfields.

The Address data type contains the following subfields:

SubfieldData TypeDescription
StreetNumberTextThe street number portion of the address.
StreetNameTextThe street name portion of the address.
CityTextThe city portion of the address.
SuburbTextThe suburb in which the address is located, if applicable.
RegionTextThe state or region portion of the address.
PostalCodeTextThe postal code or zip code portion of the address.
CountryTextThe country portion of the address.
CoordinatesLocationThe lat and lon location for the address. Lat and lon can also be accessed as subfields (for example, Address.Coordinates.Lat).
LabelTextThe type label for the address. The label is displayed when listing addresses in Fleet (for example, "Physical", "Postal", or "P.O. Box").
JavaScript conversion

In the [Script] section, an Address data type maps to a custom Address object. This is subject to the Address geocoding rules described above. If a geocode operation fails, Coordinates.Lat and Coordinates.Lon are set to 0.

Constructor
JavaScript
new AddressData({Address: "20 Enterprise, Aliso Viejo, CA, 92656", Country:"USA"})
JavaScript
new AddressData({Coordinates: {Lat: 33.58436, Lon:-117.73097}})
Available fields for (get,set)

You can access these address elements as fields:

  • .StreetNumber

  • .StreetName

  • .City

  • .Suburb

  • .Region

  • .PostalCode

  • .Country

  • .Coordinates

  • .Label