Stay organized with collections
Save and categorize content based on your preferences.
Look up a metadata instance
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:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Look up a metadata instance\n===========================\n\nThis guide describes how to use the Whistle function `mde:lookupByKey` in a\nWhistle script to look up a metadata instance object from a bucket.\n\nReference data lookup\n---------------------\n\nManufacturing Data Engine (MDE) provides a custom Whistle function to retrieve a metadata\ninstance object from a metadata bucket by natural key. Metadata instances can be\nretrieved from any bucket, but the function is commonly used to look up\nreference data from a\n[lookup bucket](/manufacturing-data-engine/docs/concepts/metadata#lookup_buckets).\n\nYou can look up a metadata instance by its natural key by calling the\n`mde:lookupByKey` function in a Whistle script. The function takes the\nlookup`bucket_name`, `natural_key` and `bucket_version` of the instance as the\narguments, and returns the latest metadata instance for the\nprovided natural key. You can use the instance to populate fields in a proto\nrecord in the parser, like in the following example:\n**Caution:** This example uses incomplete code for demonstration purposes and is not guaranteed to work. \n\n \"data\" : {\n \"complex\" : {\n \"VIN\" : mde::lookupByKey(\"vin-lookup-bucket\", input.vinKey, 1).VIN,\n \"vin_registration_time\" : mde::lookupByKey(\"vin-lookup-bucket\", input.vinKey, 1).vin_registration_time,\n \"ResultValue\" : 163.0482614,\n }\n }"]]