When entering information into your Webvanta database, you can always enter it one record at a time using the automatically created admin forms. But if you have lots of existing information to enter, it may be easier to do so by uploading a file.
To enter information into the database by uploading a file, you must create a CSV (comma-separated values) file. Any database or spreadsheet program should have an option to export this type of file.
Each import affects a single database item type. The first line of the file must be a list of the field names, as defined in the item type to which you are importing data, in the same order in which they are presented in the subsequent lines of the file.
If you are generating the file from a spreadsheet, you can accomplish this by entering the field names on the first row of the spreadsheet. If you are exporting from a database program, you may need to add this line of text manually using a text editor.
Note that this list of names must use the field names (which are for use in your code), not field labels (which are how the fields are identified on forms). Look at your item type definition at Database > Item Types > Edit to find these.
For example, suppose you have created a custom item type for Customers. To keep this example simple, let's assume the fields you want to update are first name, last name, city, and state. The CSV file would look something like this:
name,last_name,city,state
George,Smith,San Francisco,CA
Tom,Jones,Miami,FL
You can also import the SEO fields, which are part of all database items. The fields are named seo-title, seo-keywords, and seo-description.
As with any CSV file, there are some precautions you must observe to ensure that the file is valid:
George,Smith,"San Francisco, CA"
)George,Smith,"SF ""The City"", CA"
)For more information on CSV files, see the official RFC that defines the format as used in our software.
To import the information from the CSV into your site's database, choose Database Setup > Import Database Items from your site's control panel. (You must first create the custom item type, if you have not already done so.)
On the Import page:
You'll then see the import dialog, which will display until the import is complete. It will then tell you how many records were imported, if the import was successful. If the import failed, it will display error messages that should help identify the problem.
You can currently import text, text area, WYSIWYG text area, categories, tags, date, checkbox, related item, related asset, and taxonomy fields.
For checkbox fields, if the field value is 'true', '1', 'yes', or 'on'
(without the single quotes), the box will be checked (true); otherwise it will be unchecked (false).
For date (or date/time) fields, the importer supports most common formats.
For category or tag fields, you specify the name of the category or tag. If you want to associate more than one category or tag with an item, you can write more than one in that field, separated by commas, and surrounded by quotes: "category-1,category-2,category-3"
. There can be only one "categories" or "tags" header. Categories or tags must already exist in the database.
To import related item or related asset associations, the field contents must be comma-delimited lists of the exact names of the related items. Double quote the whole list. The items or assets must already exist in the database for the connection to be made (remember, you are importing only the association, not the item itself.
If you have existing records that you want to update, the importer will attempt to do so if you help it know which field to use to identify the record to be updated.
To identify the field to be used to identify records, precede that field name in the first row of the file with two asterisks (e.g., **name). Currently only the name, URL, and ID fields are supported. The value in the indicated field must uniquely identify a single record.
When a record is matched by name, it will be updated. If no-such record exists, a new record is created.
When using the update mechanism, do not select the checkbox to delete your database first. If you do, you will always generate new ID numbers.
If you are repeatedly uploading information to the same custom item type, it is helpful to be able to set the default setting for the pop-up select list. For example, a site for a mortgage broker may use a "Rates" custom item type and upload a new CSV frequently.
To set the default value, create a global setting with the name importer.defaults.import.target, and set the value to the name of the desired custom item type.