Add
Appends a new row in table and returns the new row.
| myDataTable.Add(row: object):DataRow
|
Appends a new row in table and calls callback function on it and returns the new row.
| myDataTable.Add(fn: (row: DataRow) => void):DataRow
|
Parameters
object row
Object of column values.
(row: DataRow) => void fn
Function instance to set row values.
Create a new row from object
1
2
3
4
5
6
7
8
9
10
11
12
13 | 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
1
2
3
4
5
6
7
8
9
10
11
12
13 | var table = $Database.Empty({
Parameters : {
TargetSchema : 'HR',
TargetTable : 'Groups'
}
});
table.Add(function () {
this.Id = id;
this.Name = 'Administrators-2';
});
table.Save();
|
Create a new row from object
1
2
3
4
5
6
7
8
9
10
11
12
13 | 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
1
2
3
4
5
6
7
8
9
10
11
12
13 | var table = $Database.Empty({
Parameters : {
TargetSchema : 'HR',
TargetTable : 'Groups'
}
});
table.Add(function () {
this.Id = id;
this.Name = 'Administrators-2';
});
table.Save();
|
See Also