Metadata instance lookup
This guide describes how to use the Whistle function mde:lookupByKey
in a
Whistle script to look up a metadata instance object from a bucket.
Reference data lookup
Manufacturing Data Engine (MDE) provides a custom Whistle function to retrieve a metadata instance object from a metadata bucket by natural key. Metadata instances can be retrieved from any bucket, but the function is commonly used to look up reference data from a lookup bucket.
You can look up a metadata instance by its natural key by calling the
mde:lookupByKey
function in a Whistle script. The function takes the
lookupbucket_name
, natural_key
and bucket_version
of the instance as the
arguments, and returns the latest metadata instance for the
provided natural key. You can use the instance to populate fields in a proto
record in the parser, like in the following example:
"data" : {
"complex" : {
"VIN" : mde::lookupByKey("vin-lookup-bucket", input.vinKey, 1).VIN,
"vin_registration_time" : mde::lookupByKey("vin-lookup-bucket", input.vinKey, 1).vin_registration_time,
"ResultValue" : 163.0482614,
}
}