Skip to content

DataTable.Add

Overview

object DataTable.Add ( input )
Appends a new row in table and returns the new row.

Arguments

object | function input Object or function for column values.

Remarks

Examples

Create a new row from object

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

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

table.Save();

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();