WorkersTools
Lookup
📸 Screenshots
Here are visual examples of this section:
Lookup - Worker Configuration Interface
1. Overview and Purpose
The Lookup worker performs key-value lookups by matching input text against a predefined lookup table. When the input matches a key in the table, it returns the corresponding value. If no match is found, it returns a configurable default value, making it useful for data transformation and mapping operations.
2. Configuration Parameters
The Worker accepts the following parameters:
lookupTable: A key-value mapping object where keys are matched against input text and values are returned when matches are founddefaultValue: The fallback value returned when the input doesn't match any key in the lookup table
3. Input/Output Handles
input: Input handle - accepts string values to be looked up in the tableoutput: Output handle - returns the matched value from the lookup table or the default value
4. Usage Examples with Code
// Configure lookup worker with a status code mapping
const lookupWorker = {
parameters: {
lookupTable: {
"200": "Success",
"404": "Not Found",
"500": "Server Error"
},
defaultValue: "Unknown Status"
}
}
// Input "404" would output "Not Found"
// Input "999" would output "Unknown Status"5. Integration Examples
The Lookup worker is commonly used in data processing pipelines to transform codes into readable labels, map categories to descriptions, or convert identifiers into user-friendly names.
6. Best Practices
- Keep lookup tables reasonably sized for optimal performance
- Use descriptive keys that match your expected input format exactly
- Always provide a meaningful default value to handle unexpected inputs
- Consider case sensitivity when defining keys in your lookup table
7. Troubleshooting Tips
- Verify that input keys match exactly with lookup table keys (case-sensitive)
- Check that the lookup table is properly formatted as a key-value object
- Ensure the default value is set if you expect unmatched inputs
- Remember that all inputs are converted to strings and trimmed before lookup
