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

« Previous Version 6 Next »

Overview

Appends a new row in table and returns the new row.

DataRow myDataTable.Add(row: object)

Appends a new row in table and calls callback function on it and returns the new row.

DataRow myDataTable.Add(fn: (row: DataRow) => void)

Arguments

object row
Object of column values.
(row: DataRow) => void fn
Function instance to set row values.

Example

Create a new row from object

var table = $Database.Empty({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.Add({
    id : Script.NewId(),
    name : 'Employee'
});

table.Save();

Example

Create a new row with mapper function

var table = $Database.Empty({
    Parameters : {
        TargetSchema : 'HR',
        TargetTable : 'Groups'
    }
});

table.Add(function () {
    this.Id = id;
    this.Name = 'Administrators-2';
});

table.Save();
  • No labels