Skip to content

Has

Returns a value indicating whether the specified key exists in the dictionary.

1
myDataTableDictionary.Has(key: string):boolean

Parameters

string key
    The key to check.

Returns

true if the key exists in the dictionary; otherwise, false.

Examples

Report codes that do not exist in a table

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var products = $Database.Get({
    TargetSchema : 'Sales',
    TargetTable : 'Products'
}).ToDictionary('Code');

$Xml.SelectAll('Lines/Line', function (line) {
    if (!products.Has(line.Evaluate('ProductCode'))) {
        line.SetValue('Error', 'Unknown product');
    }
});

See Also