Importing and Exporting Database

Actiweb9 database can be fully or partially exported and imported in JSON format. This functionality allows easy transportation of points between machines, easy backup and advanced computer assisted database manipulation.

In addition to JSON manipulation, Actiweb also allows importing data in CSV format.

View as JSON

In graphical web UI database can be viewed as JSON by clicking the View/edit as JSON button.

../../_images/Database-view-json.png

A window will appear that contains database data as JSON. This data can be modified either in place, or copied to a text processing program for easier editing. The data can then be copied back to the same window to apply modifications.

../../_images/Database-json-window.png

Tip

It is not neseccary to import all data back. Only the relevant bits of information can to be imported. You can safely clear all JSON data in the window and paste back just the changes. Pressing save will only use that data to import database items.

Important

Importing data with JSON editor will never delete any data. It will only add new points/fields and edit existing values, but it does not delete existing information.

Attention

All imported data must be in valid JSON format, otherwise importing will fail.

Copying database from one device to another

Using the View/edit as JSON is the most straight forward way to make a backup or copy database between devices.

First login to the device you want to import the data from. Open database view and click View/edit as JSON. Select all of the JSON data and copy it either with keyboard shortcut Ctrl -> C or by right clicking the selected text and choosing Copy. After copying the data to clipboard, you can close the window.

Tip

If you are not able to login to both machines at the same time, you can save the data in a text file until you are able to login to the second machine

Login to the second machine and follow the same steps; Open database view and click View/edit as JSON. Select all of the JSON data. Replace existing data by pasting the previous database from your clipboard. Then press save and refresh the page. Points from the first machine should appear.

Note

All points in Actiweb database use predetermined structure or schema to verify data field types and value restrictions. Some schemas are included in Actiweb by default, but some might be part of optional modules. Actiweb database will not accept imported points if it does not know the schema.

Importing CSV

Important

The CSV import only allows for tabulator (\t) separeted values. When table of data is copied from Microsoft Excel data will be automatically tab separated. In Excel it’s also possible to export to a file with tab separated values.

Database points can be created and/or updated by importing CSV formatted data. Supported CSV header in actiweb consists of three parts:

  • schema (required)

  • point name (required)

  • point fields (optional)

This means that the minimum requirements for valid CSV looks something like this:

schema

pointName

BI

alarms/trigger

More meaningful CSV could look something like this:

schema

pointName

dispUnit

Description

dataSource

AI

LTO/TE30

°C

LTO Lämpötila

rpc://ioPorts%F2P3/readch/2/2

AO

LTO/Ohajus

%

LTO Ohjaussignaali

rpc://ioPorts%F2P3/setch/4/4

AV

LTO/Hyotysuhde

%

LTO Hyötysuhde