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
QueryWithMappings options
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 datavar table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group' }); table.Save();
Example
Using map functionvar 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 datavar table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group' }); table.Save();
var table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group', map : function (node) { this.Id = node.Evaluate('../Id'); } }); table.Save();