Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

$Database.ExportToXml, and ,$Database.ImportFromXml, methods requires a unique primary key field on database table and data model.

Map Function

Map function is used to transform values before saving. For example; encrypting a password before saving to database. See $Database.ImportFromXml for more details.

...

Code Block
languagejs
$Database.ExportToXml({
    TargetSchema : 'MySchema',
    TargetTable : 'Accounts',
    XPath : 'Accounts/Account',
    // map values whose names are not identical to SQL column names
    Map : function (accountXml) {
        thisaccountXml.SetValue('Password = 'Enc:' + ', this.Password; // mark as encrypted
);
       this.AccountType = accountXml.EvaluateSetValue('Type/Code', this.AccountType);
 // map values whose names are not identical to SQL column names
    }
});

Example

Exporting database content into XML

...

Code Block
languagejs
// Export corporations with the subcorporations
Database$Database.ExportToXml({
    Parameters : {
        TargetSchema : 'Evrak',
        TargetTable : 'Kurum'
    },
    XPath : 'Corporations/Corporation',
    SubQueries : [
        {Name : 'SubCorporations'}
    ]
});

...