Difference between revisions of "HowTo:Import Data from an External System"
imported>Aeric |
imported>Aeric |
||
Line 90: | Line 90: | ||
# Go to '''Settings > Data Management > Import Data''' | # Go to '''Settings > Data Management > Import Data''' | ||
# You've already created the CSV file, so '''Step 1. Data Preparation''' is done. | # You've already created the CSV file, so '''Step 1. Data Preparation''' is done. | ||
# Under '''Step 2. Upload File''', choose the object you'll be importing into: '''Movies'''. | # Under '''Step 2. Upload File''', choose the object you'll be importing into: '''Movies'''. #: [[File:HowTo_ImportProcedure1_MoviesObject.png|border]] | ||
#: A new tab appears: '''Upload CSV File''' | |||
#: | |||
# Click '''[Choose File]''' and select the <tt>Movies.csv</tt> file you created. | # Click '''[Choose File]''' and select the <tt>Movies.csv</tt> file you created. | ||
#: [[File:HowTo_ImportProcedure2_MovieFile.png|border]] | |||
#: | |||
# No column mapping has been defined, as yet, so click '''[Next]'''.<br>The '''Map Columns''' tab becomes active. | # No column mapping has been defined, as yet, so click '''[Next]'''.<br>The '''Map Columns''' tab becomes active. | ||
# Map the columns defined in the file to the object fields: | # Map the columns defined in the file to the object fields: | ||
#* '''Record Id''' - ''Index Num - column (1)'' | #* '''Record Id''' - ''Index Num - column (1)'' | ||
#* '''Title''' - ''Title - column (2)'' | #* '''Title''' - ''Title - column (2)'' | ||
#:[[File: | #: [[File:HowTo_ImportProcedure3_MapColumns.png|border]] | ||
#: | |||
#:Note that the labels defined in the heading row of the spreadsheet table are displayed in the dialog, to help you create the correct mapping. | #:Note that the labels defined in the heading row of the spreadsheet table are displayed in the dialog, to help you create the correct mapping. | ||
# Click '''[Next]'''.<br>A dialog appears asking you to confirm the mappings. | # Click '''[Next]'''.<br>A dialog appears asking you to confirm the mappings. | ||
# After checking to make sure they're right, click '''[OK]'''.<br>The '''Set Attributes''' dialog becomes active. | # After checking to make sure they're right, click '''[OK]'''.<br>The '''Set Attributes''' dialog becomes active. | ||
#: [[File:HowTo_ImportProcedure4_MappingAttributes.png|border]] | |||
#: | |||
# Give the mapping profile a name (say, "Movie Mapping"), and optionally a description, in case you need to use it again. | # Give the mapping profile a name (say, "Movie Mapping"), and optionally a description, in case you need to use it again. | ||
# Click '''[Start]''' | # Click '''[Start]''' | ||
Line 110: | Line 117: | ||
# Examine the Movies object. | # Examine the Movies object. | ||
# Note that your data has been imported. | # Note that your data has been imported. | ||
#:[[File:HowTo_Import_MovieRecords.png|border]] | |||
Repeat the process for the Reviewers records, to complete the basic imports. | Repeat the process for the Reviewers records, to complete the basic imports. |
Revision as of 23:07, 17 May 2012
For: Designers See more: |
If you have data in an external system, you can generally export it as a plain text file, with one record per line, where values in each line are separated by values. That kind of file is known as comma-separated value (Template:CSV) file. Using such files, you can import data into your application objects.
In this guide, you'll create a few items of data in a spreadsheet, and use that. But the data could come from any system that is capable of exporting CSV data. More importantly, you'll be learning how to establish relationships between records, as the data is imported.
Preparation
Use the Application Wizard to create an application called Movie Reviews. It should have the following objects and fields:
- Movies
- Title - Text Field
- Movies
- Reviewers
- Name - Text Field
- Email - Text Field
- Reviewers
- Reviews
- Rating - Number (a value in the range 1..5)
- Commentary - Text Area (not a text field)
- Reviews
And the following relationships:
- One Movie can have many Reviews.
- One Reviewer can have many Reviews.
After the application is created:
- Adjust the singular labels for the objects.
- In the Reviews object, modify the Rating field:
- Restrict its values to the range 1..5
- Change the display length to 3
- Learn more: Use the Application Wizard.
Create a Spreadsheet with Sample Data
To start, create a spreadsheet with worksheets for some real movies, a whimisical list of reviewers, and sample reviews. (If you'd rather not deal with the spreadsheet, paste the data from the next section into CSV files.)
In those worksheets, movies have identifiers that are referenced by reviews. Those identifiers are numeric, and none are smaller than 1001. By meeting those requirements, the movie identifier can be used as a Record ID in the platform.
Export the Data as CSV Files
Next, export the data into files that contain comma-separated values, or Template:CSV data. (This process is based on Excel. The process for other spreadsheets is similar.)
- In the spreadsheet, go to the Movies tab.
- From the main menu, choose Save As.
- Specify the filename and type:
- File name - Movies.csv
- Type - CSV (Comma delimited) (*.csv)
- Click [Save]
A dialog appears, informing you that only the current worksheet can be saved. - Click [Ok] to save the current worksheet.
A dialog appears, telling that not all features are supported in this format. (For example, formulas.) - Click [Yes] to save in the specified format.
A file called Movies.csv is created. - Repeat the process for the Reviewers
- Repeat the process for the Reviews
You can now inspect the data files in a text editor. They should look like this:
- Movies.csv
- <syntaxhighlight lang="html4strict" enclose="div">
Index Num,Title 1001,The 300 1002,War Horse </syntaxhighlight>
- Reviewers.csv
- <syntaxhighlight lang="html4strict" enclose="div">
Name,Email Avery Goodview,avery@goodview Knota Goodseat,knota@goodseat Luvda Popcorn,luvda@popcorn </syntaxhighlight>
- Reviews.csv
- <syntaxhighlight lang="html4strict" enclose="div">
Movie,Rating,Commentary,Reviewer 1001,5,Awesome action,Avery Goodview 1001,5,Steamy and lovely,Knota Goodseat 1002,3,Rather predictable,Avery Goodview 1002,5,A real tear-jerker,Luvda Popcorn </syntaxhighlight>
Import the Data for Movies and Reviewers
The process here is to start at the top of the lookup chain, so that the Lookups in the incoming record all resolve to an actual record. (It isn't strictly necessary to do things in that order, but it's good form.)
Start by importing data into the Movies object:
- Go to Settings > Data Management > Import Data
- You've already created the CSV file, so Step 1. Data Preparation is done.
- Under Step 2. Upload File, choose the object you'll be importing into: Movies. #:
- A new tab appears: Upload CSV File
- Click [Choose File] and select the Movies.csv file you created.
- No column mapping has been defined, as yet, so click [Next].
The Map Columns tab becomes active. - Map the columns defined in the file to the object fields:
- Record Id - Index Num - column (1)
- Title - Title - column (2)
- Click [Next].
A dialog appears asking you to confirm the mappings. - After checking to make sure they're right, click [OK].
The Set Attributes dialog becomes active. - Give the mapping profile a name (say, "Movie Mapping"), and optionally a description, in case you need to use it again.
- Click [Start]
At this point, the import job goes into the processing queue (because most imports tend to involve a lot of data.)
In a moment or two, you should receive an email telling you that the import has finished. That message as a link to the final status report. Or at any time you can go to Settings > Monitor > Import Queue to check the status of the job.
After the message arrives:
Repeat the process for the Reviewers records, to complete the basic imports.
Import the Data for the Reviews
The Review records link to both the Movies and the Reviewers. Now that the setup is done, you'll see how to import that data, creating the relationships between those records.
--examine the Record Locator setting for the Reviewers object