Example of Importing Geography Data

This example demonstrates how to import data using Import Management.

In this example, you have a source file containing geography data that you want to import into the application to make the geography data available for real time address validation and tax purposes. A geography is any region with a boundary around it, regardless of its size. It might be a state, a country, a city, a county, or a ward.

Summary of the Tasks

You perform the following steps to create an import activity and activate the import:

  1. Determine what information is in the source file.

  2. Create and schedule the import activity.

Before You Start

  1. You use the country structure of a country to define which geography types are part of the country. For more information about an example of importing a country structure, see the topic "Example of Importing Country Structure Data".

  2. Ensure that Source ID values are unique for each row of data within a single import.

  3. Ensure that all the parents of a child geography are included in your data file so that the child geography can be added. For example, if you originally imported US, CA, and San Francisco, and now you want to import the city of San Jose in CA, then your data file must include US, CA, and San Jose.

  4. Check that your source data file has the correct values for the geography data that you have already loaded. For example, if your initial import included the value US for country and CA as state, and in a subsequent import you have California as a state, then your geography import creates two state records (CA and California) in the application data, with the US as the country parent.

Determine the Information in the Source File

The source geography data files must include a unique Source ID value for each row of data and Parent Source ID value for the parent of that row of data. You include the data that you want to import into CX Sales and Fusion Service in a source CSV file. A sample input CSV file for country as US is shown in this table.

RecordTypeCode

PrimaryGeographyName

CountryCode

LevelNumber

SourceId

ParentSourceId

LanguageCode

0

United States

US

1

1

<blank>

US

1

California

US

2

11

1

US

1

San Mateo

US

3

111

11

US

1

Redwood City

US

4

1111

111

US

1

94065

US

5

11111

1111

US

Here is a sample CSV file to import geographies with alternate name and code for country India:

RecordType

PrimaryGeographyName

CountryCode

LevelNumber

SourceId

ParentSOurceId

IdentifierType

IdentifierSubType

IdentifierValue

0

India

IN

1

1

1

Karnataka

IN

2

2

1

1

Bengaluru

IN

3

3

2

2

Bengaluru

IN

3

3

2

NAME

Standard_Name

Bangalore

1

Whitefield

IN

4

4

3

1

560066

IN

5

5

4

2

560066

IN

5

5

4

CODE

ISO_COUNTRY_CODE

91

Note: Keep a note of the following:
  • The hierarchy is modeled in the CSV file using the SourceId and ParentSourceId. The ParentSourceId for the Country Record (level Number 1) is always null.

  • If defining an alternate name (RecordTypeCode = 2) for any level below the country (LevelNumber >1), ensure that the SourceId and ParentSourceId columns match the values for the original record respectively.

  • You can't update geographies via import.

  • You can't add alternate names or alternate code of country via import. You can do so only via UI.
  • Before adding a new alternate name, make sure that the alternate name doesn't exist with the same value for any other geography name. You can check the existing values for alternate names in the Manage Geographies task page under Hierarchy Defined.

  • You can find the list of IdentifierSubTypes in Manage Geography Lookups page in the UI.

  • PrimaryGeographyCodeType and PrimaryGeographyCode can't be added after PrimaryGeographyName is created via import. You must create them together. Alternatively, you can add PrimaryGeographyCodeType and PrimaryGeographyCode from the UI after the import is complete.

You must create a source file (CSV) file with the attributes and import it using import management as shown in this table.

Attribute Name

Value

Description

RecordTypeCode

1

The record type code that represents the intent of the import data. The values are:

  • 0 - indicates the geography that already exists in the base table.

  • 1 - indicates the intent to create a new geography.

  • 2 - indicates the intent to add an alternate identifying name or code to an existing geography.

PrimaryGeographyName

India

This is the primary geography name. This will be marked as the primary name for the Geography and also displayed in the Manage Geographies Page.

CountryCode

IN

This indicates the Country Code for the country for which you're importing data.

LevelNumber

2

The level number of the geography in the hierarchy. For example, Country is at Level 1 and State (California) is at Level 2.

SourceId

2

The source ID for the geography, along with the parent source ID is used to identify the geography parent and child relationship within the source file data and the interface table data.

ParentSourceId

1

The parent source ID for the geography, along with the source ID is used to identify the geography's parent and child relationship with records within the source file data. This should be null for the country record, as Country is at the top of the hierarchy.

IdentifierType

Name

The type of the identifier. It can be either Name or Code.

IdentifierSubtype

Standard_Name or Standard_Code

The IdentifierSubtype can be Standard_Name or Secondary_Name. The default value is Standard_Name.

The valid Sub Types for Type "CODE" are FIPS_CODE, GEO_CODE, ISO_COUNTRY_CODE, PRIMARY_CITY, or UNKNOWN

IdentifierValue

Bangalore

The value of the identifier.

You can create an import activity, enter the import details, and schedule the import.

  1. Go to Navigator > Tools > Import Management > Import Queue.

  2. Click Create Import Activity in the Manage Imports page.

  3. In the Enter Import Options page, provide a name for the import activity, and select Geography from the Object drop-down list.

    Note: In the Advanced Options section, the option Enable High-Volume Import is selected by default. This mode is designed to import millions of records at once.
  4. Select the CSV file in the File Name field, and click Next.

  5. The source and target attributes are automatically mapped in the Map Fields page. Review and edit the mappings if required.

  6. Check the file for unmapped columns or data format issues by clicking Validate Data. Click Next.

  7. Review the import details on the Review and Submit page, and click Submit.