Skip to content

Martini Services Map Step

Map Steps

Map Steps are integral to setting and managing variable values within Martini. They provide a streamlined approach to declare new variables and assign values, either through map lines or set expressions.

Map Lines

Purpose: To directly map one variable's value to another.

How to Use: - Drag and drop one variable onto another in the Mapper view. - Example: EmployeesCursor = employees - To delete a map line, select it and press 'Delete' or use the right-click menu.

Set Expressions

Functionality: Allows for hardcoded values or complex logic implementations in variable assignments.

Usage: - Choose between plain text or code for set expressions. - Plain text expressions are taken as direct values, while code-based expressions are evaluated at runtime. - To add a set expression, right-click on an output variable, double-click, use Alt + E, or employ content-assist.

Example:

1
2
3
4
5
employees = [
    new Employee(firstName: 'Patricia', lastName: 'Smith'),
    new Employee(firstName: 'Tristan', lastName: 'Miller'),
    ...
]

Set Expression Dialog: Resembles the script step editor with additional features like inserting property expressions and handling variable paths.

Accessing Variables

  • The $context variable in set expressions represents all variables visible in the Mapper.
  • Property paths can be inserted with template strings using shortcuts or the context menu.

Priority in Map Steps

  • Map Steps execute based on the priority assigned to each map line or set expression.
  • Lower priority numbers are executed first, allowing control over the execution order.

Error Handling

  • Set expressions throwing exceptions are reported with detailed stack traces, indicating the specific line and expression where the error occurred.
  • Runtime exceptions due to syntax errors are handled like other exceptions, with catch mechanisms in block steps.

Declaring and Unloading Variables

  • Variables can be declared in multiple ways, including context menus, hotkeys, content-assist, or dragging from the Navigator view.
  • Unload variables when they're no longer needed to maintain clarity in the Mapper view.

Best Practices

  • Avoid overloading set expressions with extensive code; opt for script steps or reusable classes.
  • Manage priorities wisely to ensure correct execution order.
  • Regularly unload unused variables for cleaner code and easier management.