In Boomi, the two types of map functions are Standard and User-Defined. Standard functions perform a single, predefined action, while User-Defined functions chain together multiple standard and custom steps to perform more complex transformations.
Standard functions
Standard functions are the building blocks of transformation logic in a Boomi map. They are a library of pre-built, single-step operations that handle common data manipulation tasks without any complex configuration. You can add a standard function by selecting it from a categorized list in the map configuration window.
Key characteristics:
- Simple and single-purpose: Each standard function is designed for a specific task, such as converting a string to uppercase or calculating an absolute value.
- Easy to use: They require little configuration, typically just providing the input and output parameters.
- Categories: Standard functions are grouped into logical categories to help users find the right tool for the job. Common categories include:
- String: Concatenation, trimming whitespace, converting case, replacing characters.
- Numeric: Mathematical operations like add, subtract, multiply, and divide, as well as rounding and precision control.
- Date: Formatting dates, converting to and from timestamps, and performing date calculations.
- Logical: If/Else, value selection, and comparison logic.
- Specialized: Functions for sequential value generation, running totals, and lookups.
**When to use standard functions:**Standard functions are ideal for straightforward data transformations that can be accomplished in a single, atomic step. For instance, if you need to:
- Convert a product code to all caps.
- Combine a first name and last name into a single "Full Name" field.
- Format a date from one standard to another.
- Calculate a total cost by multiplying a quantity and a unit price.
User-defined functions
User-Defined functions, also known as custom functions, are reusable components that allow you to combine multiple standard functions and custom scripts into a defined sequence. This provides a powerful way to encapsulate complex business logic and promote reusability across multiple maps and processes.
Key characteristics:
- Complex transformations: They are used for sophisticated logic that requires multiple transformation steps.
- Reusable component: Once created, a User-Defined function is saved as a standalone component. This means it can be used and managed independently of any specific map.
- Chaining steps: You can create a sequence of steps by linking the output of one function to the input of the next.
- Custom scripting: User-Defined functions can also incorporate custom code using JavaScript or Groovy. This is done via the Custom Scripting function and allows for highly tailored manipulations that may not be possible with standard functions alone.
**When to use user-defined functions:**User-Defined functions are best suited for handling intricate or recurring transformation requirements. Use them when you need to:
- Apply a complex formula: For example, calculating a special tax that involves multiple steps, lookups, and conditions.
- Standardize complex logic: Create a reusable function to handle a specific address formatting rule that is used in many different maps.
- Consolidate and simplify: A User-Defined function can replace a messy, multi-step series of connections directly on the map, making the map itself cleaner and easier to understand.
- Implement conditional logic with scripting: Use a script to perform an if/then/else evaluation based on multiple dynamic conditions.
Comparison summary
| Feature | Standard Functions | User-Defined Functions |
|---|---|---|
| Purpose | Single, atomic transformation. | Sophisticated transformations with multiple steps. |
| Complexity | Simple, requiring minimal configuration. | Can be highly complex, chaining multiple functions together. |
| Reusability | Added directly to a map; not reusable components. | Saved as standalone components and reused across processes. |
| Composition | Pre-built, single-step operations. | Constructed by chaining standard functions and scripts. |
| Custom Scripting | N/A | Can include steps that execute custom JavaScript or Groovy code. |
| Use Case | Formatting a date, converting text case, adding two numbers. | Reusable address standardization, calculating complex tax rates, implementing complex business logic. |