Overview
DataTable DataTable myDataTable.ImportFromXml(options: QueryWithMappings)
...
Remarks
ColumnsXPath is used to specify additional secondary mapping path by XPath argument.
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
Code Block | ||
---|---|---|
| ||
var table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group' }); table.Save(); |
Example
Using map function
Code Block | ||
---|---|---|
| ||
var table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group', map : function (node) { this.Id = node.Evaluate('../Id'); } }); table.Save(); |
...
{ // Array of columns Columns : Array<QueryColumn> Map : (node: XmlNode Xml) => void // Maximum number of rows. If not set all rows are returns. MaxLength : number // Root node of mapping. If not specified $Xml instance is used. Node : XmlNode Xml // Array of order columns Order : Array<QueryOrder> // Additional parameters Parameters : object // Start index of rows. Start : number // Array of sub queries. SubQueries : Array<SubQuery> // Name of schema to execute query on. TargetSchema : string // Name of table to execute query on. TargetTable : string // Criteria of query Where : QueryBlock // Root xpath to be mapped. XPath : string }
...
{ // Comparison operator. Default value is Equals. Comparison : ( "Equals" | "Different" | "LessThan" | "GreaterThan" | "LessThanOrEqualTo" | "GreaterThanOrEqualTo" | "Like" ) // Condition with next criteria. If not specified And value is used. Condition : ( "And" | "Or" ) // Criteria expression. Expression : string // Array of ignored values. IgnoredValues : any // Value or Expression to compare Value : any // Type of value. If not specified Direct value is used. ValueType : ( "Direct" | "Expression" ) }
Examples
...
Code Block | ||
---|---|---|
| ||
var table = $Database.Get({
Parameters : {
TargetSchema : 'HR',
TargetTable : 'Groups'
}
});
table.ImportFromXml({
XPath : 'Groups/Group'
});
table.Save(); |
...
language | js |
---|
...
)
...
}
...