Populate from Contact formula

To localize the Populate from Contact formula you must modify the part of the formula that gets address data from the database. The default code is shown below, along with modified code for different regional settings.

Default formula (US)

Dim data As New DataSet
 Dim dt As DataTable = data.Tables.Add()
dt.Columns.Add("AddressKey", System.Type.GetType("System.Int32"))
dt.Columns.Add("StreetNumber", System.Type.GetType("System.String")) 
dt.Columns.Add("StreetName", System.Type.GetType("System.String"))
dt.Columns.Add("Suffix", System.Type.GetType("System.String"))
dt.Columns.Add("City", System.Type.GetType("System.String"))
dt.Columns.Add("State", System.Type.GetType("System.String"))
dt.Columns.Add("ZIP", System.Type.GetType("System.String")) 

Dim i As Integer 
Dim oAddress As IAddress 
		
for i=0 To myAddresses.Count-1 
		
   oAddress = CType(myAddresses(i), IAddress) 
   Dim dr As DataRow = dt.NewRow()
   dr("AddressKey") = oAddress.GetProperty("AddressKey")
   dr("StreetNumber") = oAddress.GetProperty("StreetNumber")
   dr("StreetName") = oAddress.GetProperty("StreetName")
   dr("Suffix") = oAddress.GetProperty("Suffix")
   dr("City") = oAddress.GetProperty("City")
   dr("State") = oAddress.GetProperty("State")
   dr("ZIP") = oAddress.GetProperty("ZIP")
   dt.Rows.Add(dr)

Canada

Dim data As New DataSet
Dim dt As DataTable = data.Tables.Add()
dt.Columns.Add("AddressKey", System.Type.GetType("System.Int32"))
dt.Columns.Add("StreetNumber", System.Type.GetType("System.String")) 
dt.Columns.Add("StreetName", System.Type.GetType("System.String"))
dt.Columns.Add("StreetSuffix", System.Type.GetType("System.String"))
dt.Columns.Add("City", System.Type.GetType("System.String"))
dt.Columns.Add("Province", System.Type.GetType("System.String"))
dt.Columns.Add("PostalCode", System.Type.GetType("System.String")) 

Dim i As Integer 
Dim oAddress As IAddress 

for i=0 To myAddresses.Count-1 

  oAddress = CType(myAddresses(i), IAddress) 
  Dim dr As DataRow = dt.NewRow()
  dr("AddressKey") = oAddress.GetProperty("AddressKey")
  dr("StreetNumber") = oAddress.GetProperty("StreetNumber")
  dr("StreetName") = oAddress.GetProperty("StreetName")
  dr("StreetSuffix") = oAddress.GetProperty("StreetSuffix")
  dr("City") = oAddress.GetProperty("City")
  dr("Province") = oAddress.GetProperty("Province")
  dr("PostalCode") = oAddress.GetProperty("PostalCode")
  dt.Rows.Add(dr)

UK

Dim data As New DataSet
Dim dt As DataTable = data.Tables.Add()
dt.Columns.Add("AddressKey", System.Type.GetType("System.Int32"))
dt.Columns.Add("HouseNumber", System.Type.GetType("System.String")) 
dt.Columns.Add("StreetName", System.Type.GetType("System.String"))
dt.Columns.Add("Town", System.Type.GetType("System.String"))
dt.Columns.Add("County", System.Type.GetType("System.String"))
dt.Columns.Add("PostCode", System.Type.GetType("System.String")) 

Dim i As Integer 
Dim oAddress As IAddress 

for i=0 To myAddresses.Count-1 

  oAddress = CType(myAddresses(i), IAddress) 
  Dim dr As DataRow = dt.NewRow()
  dr("AddressKey") = oAddress.GetProperty("AddressKey")
  dr("HouseNumber") = oAddress.GetProperty("HouseNumber")
  dr("StreetName") = oAddress.GetProperty("StreetName")
  dr("Town") = oAddress.GetProperty("Town")
  dr("County") = oAddress.GetProperty("County")
  dr("PostCode") = oAddress.GetProperty("PostCode")
  dt.Rows.Add(dr)

Australia

Dim data As New DataSet
Dim dt As DataTable = data.Tables.Add()
dt.Columns.Add("AddressKey", System.Type.GetType("System.Int32"))
dt.Columns.Add("HouseNumber", System.Type.GetType("System.String"))            
dt.Columns.Add("StreetName", System.Type.GetType("System.String"))
dt.Columns.Add("StreetType", System.Type.GetType("System.String"))
dt.Columns.Add("Suburb", System.Type.GetType("System.String"))
dt.Columns.Add("State", System.Type.GetType("System.String"))
dt.Columns.Add("PostalCode", System.Type.GetType("System.String"))

Dim i As Integer 
Dim oAddress As IAddress

for i=0 To myAddresses.Count-1

  oAddress = CType(myAddresses(i), IAddress)      
  Dim dr As DataRow = dt.NewRow()
  dr("AddressKey") = oAddress.GetProperty("AddressKey")
  dr("HouseNumber") = oAddress.GetProperty("HouseNumber")
  dr("StreetName") = oAddress.GetProperty("StreetName")
  dr("StreetType") = oAddress.GetProperty("StreetType")
  dr("Suburb") = oAddress.GetProperty("Suburb")
  dr("State") = oAddress.GetProperty("State")
  dr("PostalCode") = oAddress.GetProperty("PostalCode")
  dt.Rows.Add(dr)

New Zealand

Dim data As New DataSet
Dim dt As DataTable = data.Tables.Add()
dt.Columns.Add("AddressKey", System.Type.GetType("System.Int32"))
dt.Columns.Add("HouseNumber", System.Type.GetType("System.String")) 
dt.Columns.Add("StreetName", System.Type.GetType("System.String"))
dt.Columns.Add("StreetType", System.Type.GetType("System.String"))
dt.Columns.Add("Suburb", System.Type.GetType("System.String"))
dt.Columns.Add("State", System.Type.GetType("System.String"))
dt.Columns.Add("PostalCode", System.Type.GetType("System.String")) 

Dim i As Integer 
Dim oAddress As IAddress 

for i=0 To myAddresses.Count-1 

  oAddress = CType(myAddresses(i), IAddress) 
  Dim dr As DataRow = dt.NewRow()
  dr("AddressKey") = oAddress.GetProperty("AddressKey")
  dr("HouseNumber") = oAddress.GetProperty("HouseNumber")
  dr("StreetName") = oAddress.GetProperty("StreetName")
  dr("StreetType") = oAddress.GetProperty("StreetType")
  dr("Suburb") = oAddress.GetProperty("Suburb")
  dr("State") = oAddress.GetProperty("State")
  dr("PostalCode") = oAddress.GetProperty("PostalCode")
  dt.Rows.Add(dr)