Altova MapForce 2025 Professional Edition

You can create node functions and defaults for almost any item in the mapping. Creating node functions and defaults means defining a rule. To create a rule, select an item (node or field) for which you want to define a rule. This can be a single node or a node with child nodes. If you choose to create a rule for a node with children, the rule will apply to all the children unless you disable this option explicitly.

 

Important aspects of defaults and node functions

Defaults and node functions have the following important aspects:

 

You can create defaults and node functions on the input side of a target component or on the output side of a source component. To establish which side is right for your needs, see Input vs. Output Side.

 

When multiple rules exist for one and the same item, MapForce will apply the rule that is closer to that item. To find out how to override rules, see Scenario 4 in Use-Case Scenarios.

 

Defaults and node functions can be created if the connection type between the source and target is source-driven or target-driven. However, copy-all connections are not supported. Specifically, node functions and defaults do not apply to descendants of copy-all connections. The parent node with the copy-all connection can have node functions and defaults but only if this parent node has a simple value, for example, an XML element with simple-type content and attributes. For more information about connection types, see Connection Types.

 

Creating defaults and node functions is not supported for the File node.

 

Inside a node function, only certain components meaningful in this context are supported (e.g., built-in functions, variables, if-else conditions). Complex structures such as XML, JSON, EDI, or databases are not supported. Adding inline user-defined functions and join components to a node function is not supported.

 

A node function can have one input parameter or no parameter at all. The input parameter is always called raw_value. Do not delete the input parameter even if you do not need an input for your function; otherwise, validation errors will occur when you run the mapping. The same applies to the function's output. Should you need to restore an accidentally deleted input component, run the menu command Function | Insert Input.

 

MapForce allows you to supply node metadata (e.g., a node name, an annotation) to a node function. For details, see Node Metadata in Node Functions.

 

The Filter Node Functions and Defaults dialog box allows you to choose from an extensive range of data types, some of which are categories of types. This means that they will match a larger selection of types. For example, the type string matches various other data types derived from string, such as normalizedString, token, NCName, NMTOKEN, IDREF, ENTITY, and others. Likewise, the type decimal will match the derived types integer, long, short, and others. The hierarchy of types is specified in the XML Schema W3C Recommendation.

 

Create a rule

To create a rule, take the following steps:

 

1.Right-click the node of interest and select Node Functions and Defaults | Input/Output Node Functions and Defaults from the context menu. Whether it is Input or Output Node Functions and Defaults depends on the side of the component on which you need to create a node function or a default. Alternatively, right-click a connector and select the node function command for that side. The Mapping pane will display the Node Functions window, in which you can define defaults and node functions (red rectangle in screenshot below).

mff_nodefunc_ex2

If a parent node has rules defined for it, and you want to transfer these rules from the parent to a child, select the Inherit rules from ancestors check box (screenshot above). For more information about inheritance, see Use-Case Scenarios.

 

2.The next step is to define whether you want to add a default ( mf_ic_add_default ) or a function ( mf_ic_add_nodefunc ). As soon as you click the relevant option, a new rule will be created (a row in the grid in the Node Functions window). For information about rule configuration, see Rule Configuration below. If you are defining a function, the mapping area will display the function's input and output parameters.

 

Edit/delete rules

To view, modify, or delete a rule, click the mf_ic_node_func_defined icon (black or red) next to a node of interest. The Node Functions window will display all the rules defined for this node. If you have added a node function, you will see the mf_ic_nodefunc_edit button in the grid, which allows you to change the implementation of the function. If the mf_ic_nodefunc_edit button is not present, the function is most likely defined on some ancestor. In this case, click the mf_ic_node_func_defined icon near the item for which the rule has been defined.

 

To delete a rule, select it from the grid in the Node Functions window and then click the ic_paramdel button.

 

Configure a rule

As soon as you select Node Functions and Defaults | Input/Output Node Functions and Defaults from the context menu (see instructions above), you will see the Node Functions window in which you can configure node functions and defaults. The available settings are described below.

 

Apply to: A rule can apply to the current item, its direct child items, or to all descendant items. If the item you have selected has no descendants, only the Current item option will be available.

 

Data type: Click the mf_ic_ellipsis button and select a data type from the dialog box. The rule will apply only to items of this data type (or a derived data type). If the item you have selected has no descendants, the item's data type is the only choice.

 

Default Value/Function Description: If you are defining a default, type the default value that you wish to set for the selected item (and all descendants, if applicable). To set an empty string as a default, leave this field empty. If you are defining a function, this field is for information only: It displays a summary of the function.

 

To exit the Node Functions window, click the mf_ic_exit_door button in the upper-left corner of this window or press Escape.

 

Visual clues

MapForce displays different visual clues to help you understand which rules are defined and whether they apply to a specific node (see table below).

 

Icon

Description

mf_ic_node_func_defined

This icon indicates that a rule has been defined for this item and may affect all its descendants. Click the icon to modify or delete the rule.

mf_ic_node_func_applied

This icon indicates that the item inherits the rule defined at ancestor level.

mf_ic_node_func_defined_applied

This icon indicates that a rule is defined for and applies to this item. This icon usually appears when a function or a default is defined for a single node.

mf_ic_node_function_blocked

This icon indicates that even though a rule applies to this item, it is deliberately blocked. This icon is displayed only if inheritance is blocked and no other rules are defined for this node. If a rule from an ancestor does apply, the mf_ic_node_func_appliedicon has priority.

mf_ic_node_func_inactive

This icon indicates that a rule defined for this item is inactive. For example, this icon may appear for child items that are not connected yet.

ic_nodefunc_unconnected

This icon indicates that the rule is currently inactive, because no matching and connected nodes have been identified. By matching the following is meant: Before applying a function or a default, MapForce looks for the data type you have defined; if you have also specified a filter that must match a specific node name, for example, MapForce will also look for the relevant node name.

 

© 2018-2024 Altova GmbH