💡 Code Feature – Centralized Override Logic
The Code feature allows you to define custom override logic at the Output Schema level. This provides centralized control across multiple pipelines, enabling:
- One-time setup of complex logic
- Consistent application across workflows
- Reduced duplication and error potential
For example, if you want to apply a custom if-then-else rule to all files of a specific type, you would configure that logic here.
✅ Benefits
- Consistency – The same logic is applied wherever it's needed
- Maintainability – Update the logic once to apply it across all relevant workflows
- Efficiency – Eliminate redundant code and reduce risk of mistakes
🔧 Types of Code Overrides and Optimization
Use code overrides to apply and optimize logic either across multiple pipelines or within a specific file. This helps simplify and standardize behavior.
- Primary
- Final
- Reduce
- Remove duplicate logic
- Break down long functions into smaller pieces
- Use built-in Scala features to streamline logic
Code override applied at the Output Schema level, shared across multiple pipelines
File-specific override used in the Builder for individual files
Used to clean up or simplify code
Examples:
⚙️ Code Functions
These functions help you manage how code is written, applied, and compiled within your schema:
- Enabled – Activates code for the output schema
- Reset – Reverts to the last saved version
- Code Snippet – Write reusable code for use in the Builder
- Compile – Validates and applies changes (Note: Save before compiling)
📝 Creating and Using Code Snippets
To create a snippet:
- Click the Code Snippet button
- The Edit Snippet screen appears
- Enter a Name and valid Scala code
- Click Save
The snippet's Create Date, Name, and Content will appear on the Code Snippets page. Use the menu icon to Edit or Delete the snippet.
📁 Applying a Snippet in Builder
- Navigate to Files > Manage Files
- Select a file and click Open in Builder
- In the Builder menu bar, select Code
- The Code Override screen appears
- Remove any code you wish to replace
- Click the Code Snippet button to copy the snippet to your clipboard
- Click Code again to close the override screen
⚠️ If you're not using the override, be sure to click Delete to avoid unintended performance impacts.