DataTableDictionary.Ensure
Overview¶
Object DataTableDictionary.Ensure ( key, [properties], [initProperties] )
Return Value¶
Matching row instance.
Arguments¶
String key Required. Key of rows to be updated or added.
Object properties Row properties to be updated.
Object initProperties Row properties to be updated if no match found.
Remarks¶
- initProperties argument used as to initialize a new row no matching row found in DataTable.
- This method inserts or updates rows in DataTable.
Examples¶
var table = $Database.Get({ Parameters : { TargetSchema: 'HR', TargetTable: 'Groups' } }); var list = table.ToDictionary('Name'); var myGroup = list.Ensure("MyGroup", { Code : '123' }, { Id : Script.NewId() }); list.Save();