RO CSVI

Custom tables import

Requirements

  • CSVI 6.0+
  • Joomla 3+

Background information

The custom import is a special import. This import allows you to import data into any available database table in your system. The table must have a primary key, otherwise it will not work.

Creating the template

First we will create an import/export template in which we can store all our preference. Let's say we are going to do an custom table import

  1. Go to Components
  2. Go to CSVI Pro
  3. Click on Templates -> Templates

Now you are on the templates page, this is where the import and export templates are created. Click on New button on top corner and follow the Create a template tutorial to create your template. 

  • Give a descriptive name for the template
  • Select Import as Action
  • Component as CSVI pro
  • Operation as Custom tables
  • Enable logging if set to Yes
    This is a very important option. Setting this to Yes will tell CSVI to create a detailed log of all steps taken during export. This is a very useful report to find any potential problems. Whenever you post a question on the forum, make sure you post this file also. It is the only way to help you out. The How to collect debug information article explains this in further detail.

Setting the options

The next step is to tell CSVI for which custom table you want to import, from the options tab, select the table.

 

Available from version 6.7.0

You can now set the field based on with which import should be done. It is now not restricted to primary key field but to any valid column name from the database table. On options tab, under the custom table, you can select the import based on field. If nothing is set then custom table primary key field will be used.

custom table import based on

Now that the options are set, Don't forget to click on Save to save your changes in your template and make sure they don't get lost.

Adding the fields

Now that template is created we need to add fields to be imported. Fields depend on the custom table you have selected for importing. In this tutorial, content table is taken as example, so for importing into content table, fields are added like

Once the template and template fields are set, importing is done in a normal way as we do for other templates.

Validation

The custom import does not do any validation on the data being imported. You will have to make sure that the import data is correct.

Adding and updating

Data is managed based on the primary key field of the table. If the primary key field is included in the import file, the data is updated regardless if the primary key exists or not. If the primary key field is not included in the import file, the data is added.

Supported tables

CSVI supports all tables that are supported in the Joomla installation to be imported/exported. 

Creating A Custom Import File

To create an import file for a custom import it is important to know what data is expected for the table you are going to import. To know which fields are available for your custom import, take these steps:

  1. Go to Components -> CSVI/CSVI Pro ->Maintainence tab -> Available Fields
  2. Select Import
  3. Select CSVI/CSVI Pro
  4. Select Custom tables
  5. Click on Go
  6. Click on the column Table to sort the fields on Table
  7. Now scroll to the table you want to import and you can see the fields that are available for import

Import a Custom Import File

To import your custom import file, take these steps:

  1. Go to Components -> CSVI/CSVI Pro -> Import tab
  2. Select Template we created for custom import
  3. Click Select file

Choose the file to import and click on Preview from top corner. CSVI will display the lines from the csv file as a preview.

If the data importing is correct, click on Start import from top right corner and CSVI will import all data from the csv file. Once import is done status of the import and logs will be displayed as per preferences set in the template.