Skip to main content

Importing Data

Importing Data

 

Importing data into EonicWeb uses XML and XSLT similar to a number of other processes.

First of all create a folder in the site root for xsl/Import and add a file called ImportManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<Imports>
<ImportGroup name="Imports">
<Import name="Users" xslFile="Users.xsl" importDoc="xml">Users</Import>
</ImportGroup>
</Imports>

You also need to add an xslFile in this same folder as specified for each type.

This xsl file converts the imported data into a series of "Instances" of data to be imported. An instance being an xml representation of the data to go into the site table.

You will find example files in ewcommon/xsl/import

You will then need to create a directory above the wwwroot directory to receive the uploaded files called imports .

Now you are ready to test and debug your import.

In the admin system go to Settings / Import Files

Using this form you can upload your file and view the XML imported and the instances created before running a full import.

 

Importing from a CSV or Excel XLS file

 

The system will convert these files into an XML file to be translated, you need to ensure the site is running in 32bit mode in order for this feature to work. Please speak to the server administrator to change your site to a 32bit enabled application pool.

 

Importing from a database

 

Importing from a MSSQL database the import xml file must be in this format...

<?xml version="1.0" encoding="utf-8" ?>
<DatabaseImport databaseServer="dbservername" databaseName="importDatabaseName" databaseUsername="dbUser" databasePassword="xxx123" tableName="dbo.person" select=""/>

This XML specifies the information required to import XML data from another database, there must be a permitted network connection on the MSSQL required ports between the web server and the specified database server.

The table name specifies a table to import all data from, it also specifies the name around each row to be imported in the XML created.

If a select statement is specified then that will override the table name, but the table name should still be specified for the XML generated. 

 

Import Options

 

Below is an example of the options you can specifiy in the import XML

<xsl:template match="/NewDataSet">
<Instances>
<DeleteNonEntries enabled="false">
<cDefiningField>cDirSchema</cDefiningField>
</DeleteNonEntries>
<SkipExisting enabled="false"/>
<NoLocations enabled="false"/>
<ResetLocations enabled="false"/>
<xsl:apply-templates select="dbo.person" mode="Instance"/>
</Instances>
</xsl:template>

Deleting Items not included in the Import

If you want to delete items that are not included in your import then you need to add the following XML into your instances Node.

The defining field narrows the selection of items to be deleted for instance if we are importing users it should be cDirSchema if Content then cContentSchemaName

Skipping Existing

With this option enabled you will never update existing records, as defined by the foreign reference.

No Locations

Adds the content without a default location

Reset Locations

Removes any earlier locations for the content

 

Content Options

 

Location

Add the following Xml inside the table node

<Location foriegnRef="fRef" id="123" primary="true" position="pagePosition"/>

Relation

Add the following Xml inside the table node

<Relation foriegnRef="fRef" type="relationType" relatedContentId="0"/ >

 

Directory Options

 

If you are importing a use and you want to add a user to a company for instance or a user to a membership group you need to add the following inside the table name node.

<Relation relatedDirId="1" foriegnRef="ref"/>

 

Adding Pages with new Content

 

If you are importing a page you can insert content onto that page as well. Buy adding Contents/instance to the page information where the instance is a content item.