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:
-
Determine what information is in the source file.
-
Create and schedule the import activity.
Before You Start
-
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".
-
Ensure that Source ID values are unique for each row of data within a single import.
-
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.
-
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 |
|
US |
1 |
1 |
<blank> |
US |
1 |
|
US |
2 |
11 |
1 |
US |
1 |
|
US |
3 |
111 |
11 |
US |
1 |
|
US |
4 |
1111 |
111 |
US |
1 |
|
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 |
|
IN |
1 |
1 |
||||
1 |
|
IN |
2 |
2 |
1 |
|||
1 |
|
IN |
3 |
3 |
2 |
|||
2 |
|
IN |
3 |
3 |
2 |
NAME |
Standard_Name |
|
1 |
|
IN |
4 |
4 |
3 |
|||
1 |
|
IN |
5 |
5 |
4 |
|||
2 |
|
IN |
5 |
5 |
4 |
CODE |
ISO_COUNTRY_CODE |
91 |
-
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:
|
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.
-
Go to Navigator > Tools > Import Management > Import Queue.
-
Click Create Import Activity in the Manage Imports page.
-
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.
-
Select the CSV file in the File Name field, and click Next.
-
The source and target attributes are automatically mapped in the Map Fields page. Review and edit the mappings if required.
-
Check the file for unmapped columns or data format issues by clicking Validate Data. Click Next.
-
Review the import details on the Review and Submit page, and click Submit.