Knowledge Base

Import articles

Article ID: 99
Last updated: 25 Sep, 2023

You can import articles in bulk.
You might want to do this, say, if you are changing over to KBPublisher from another system.

The process is:

  • Create a file of articles to import
  • Upload a test sample to the system
  • Import.

Create a file of articles to import

First, you need to create your file of articles. This is a comma-separated (CSV) text file that consists of some or all of: title, body, date_posted, id, author_id, updater_id, meta_keywords, meta_description, entry_type, external_link, date_updated, hits, sort_order, private and an active flag.

  • The first three fields (title, body and date_posted) must be included. You can include some, all or none of the others as required.
  • They do not have to be in the same order as above, but each line in the import file must contain the same fields in the same order.
  • The active flag defaults to '1', which is active, so they only time you would set this is if you don't want the users to be active.
  • Place the data for each user onto a single line, and separate each field by a comma. Do not include spaces before or after the comma.
  • Place quotes (") around text fields such as body, and be sure to check that your text does not have quotes within the text. If your body, or other text field, does contain quotes, choose a different delimiter and update the fields optionally enclosed by field to match.
  • The TestImportArticle.csv file shows a sample of what your upload file should look like. This file includes the three default fields only.
  • Field sizes and types are specific, as per the table below. Your data must fit within these parameters or the upload will fail.
Field Type/size M/O Comments
title text M
body mediumtext M
date_posted datetime O Format 0000-00-00 00:00:00
id int(10) O Record ID. If this record ID already exists in the database KBPublisher will skip the record. It will not overwrite an existing ID.
author_id int(10) O If not supplied, the user currently logged in and importing the articles is set as the author.
updater_id int(10) O If not supplied, the user currently logged in and importing the articles is set as the updater.
meta_keywords text O Format should be the same as if you are adding the keywords in add new article.
meta_description text O
entry_type tinyint(3) O Type.
external_link text O
date_updated timestamp O Defaults to time imported to knowledgebase.
hits int(10) O Defaults to 0.
active tinyint(1) O Defaults to 1.

Create a test file

Don't try to upload the whole file without testing it first. If something goes wrong you may then have to delete all those half-imported articles and try again. Create a test file and run that first.

  • Copy the first, say, three lines of your text import to a separate file
  • Either:
    • Save the file to a local drive (e.g. somewhere on your c: drive)
    • Upload the file to the server

Import the test file

You are now ready to import the test file to KBPublisher.

  • Click on the Import/Export menu
  • Click on the Import Articles tab
  • If the import file is on your c: drive (or another local drive),
    • Choose Load Data Local File in the SQL Load Command field
    • Browse for the CSV file on your drive and load it
  • If the import file is on the server,
    • Choose Load data file
    • Type the address where the file is located into the Path to file field on CSV file line
  • Move the CSV fields around to specify which fields are in the file and what order they are in.
    Do this by clicking on the name of the field you want to move and dragging and dropping it into the appropriate place.
    For example, suppose you want the three mandatory fields included, plus the author ID. You need to move the user_ID field from the Available table fields box into the Fields in CSV file box.
    • Click on the user_ID field and hold the mouse down
    • While holding the mouse down, drag the date_registered field over to the Fields in csv file box
    • Drop the field into the box by releasing the mouse

      KBPublisher quick add
      Make sure that you place it in the order it appears in the file.
  • Change CSV options if required.
  • Click Load

On completion of the load, you will see a message at the top of the Import Articles screen telling you how many files were imported successfully and how many were skipped.

  • If the upload was successful, click on the Articles tab to check out the articles.

Fix any problems

All going well, you should now have three new articles in your knowledgebase. Check them carefully and ensure that everything worked as you expected. If you had problems, delete these three articles, fix the test file and run it again. Keep fine-tuning until it works, and then update the real file to match the fixes you made in the test file.
You are now ready to import the rest of the articles.

Import articles

Import the rest of the articles using the same process as for the test file, only this time using the real data file.

Note:

  • Articles are imported with a category name of Imported. If this category does not exist it will be created as part of the upload process.
  • If any unique keys will be duplicated during import, records from cvs file will be ignored.
  • Use the bulk actions option to change the categories, etc.
Article ID: 99
Last updated: 25 Sep, 2023
Revision: 6
Access: Public
Views: 20406
Comments: 0
Also listed in