...
( DataRow | Array<DataRow> ) DataTableDictionarymyDataTableDictionary.Ensure(key: string, input: object)
( DataRow | Array<DataRow> ) DataTableDictionarymyDataTableDictionary.Ensure(key: string, input: object, initInput: object)
...
Row properties to be updated if no match found.
Remarks
initProperties argument used as to initialize a new row no matching row found inDataTable.This method inserts or updates rows inDataTable.
Example
Code Block | ||
---|---|---|
| ||
var table = $Database.Get({
Parameters : {
TargetSchema : 'HR',
TargetTable : 'Groups'
}
});
var list = table.ToDictionary('Name');
var myGroup = list.Ensure("MyGroup", {
Name : 'MyGroup',
Code : '123'
}, {
Id : Script.NewId()
});
list.Save(); |
Returns
...
Remarks
initProperties argument used as to initialize a new row no matching row found in DataTable.
This method inserts or updates rows in DataTable.
Example
Code Block | ||
---|---|---|
| ||
var table = $Database.Get({ Parameters : { TargetSchema : 'HR', TargetTable : 'Groups' } }); var list = table.ToDictionary('Name'); var myGroup = list.Ensure("MyGroup", { Name : 'MyGroup', Code : '123' }, { Id : Script.NewId() }); list.Save(); |
Examples
...
language | js |
---|
...