Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

Imports xml data to specified table. If record already exist in table it's updates existing. If no record exist a new record added to table. Comparison automatically done with table primary key.

DataTable DataTable.ImportFromXml(options: QueryWithMappings)

Arguments

Specifies the import options and may contain one or more following properties:

Remarks

This method does not call save method after execuiton. If you want to save changes, you need to explicitly call Save method or use $Database.ImportFromXml instead.

Example

Common use for importing data
var table = $Database.Get({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.ImportFromXml({
    XPath : 'Groups/Group'
});

table.Save();

Example

Using map function
var table = $Database.Get({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.ImportFromXml({
    XPath : 'Groups/Group',
    map : function (node) {
        this.Id = node.Evaluate('../Id');
    }
});

table.Save();

Examples

Common use for importing data
var table = $Database.Get({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.ImportFromXml({
    XPath : 'Groups/Group'
});

table.Save();
Using map function
var table = $Database.Get({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.ImportFromXml({
    XPath : 'Groups/Group',
    map : function (node) {
        this.Id = node.Evaluate('../Id');
    }
});

table.Save();
  • No labels