Altova MapForce 2025 Enterprise Edition

Example: Exception on "Greater Than" Condition

Home Prev Top Next

This example illustrates a mapping that throws an exception when a "Greater Than" condition occurs. The sample mapping accompanying this example can be found at: <Documents>\Altova\MapForce2025\MapForceExamples\ExpenseLimit.mfd.

except-xslt

This mapping throws an exception whenever the expense item in the source XML instance has a value greater than 200. The value "200" is provided by a constant. The less function is then used to compare the two values. If the value of expense is less than 200, then its parent, the expense-item, is passed on to the filter, and no exception is thrown. Otherwise, an exception is thrown, with the custom text "Expense limit exceed".

 

As shown above, the exception is identified by the ic-component_exception icon and it consists of two items: throw and error-text. The throw item must be connected to the on-false or on-true output of a filter. The error-text is connected to a constant which provides the custom text of the exception.

 

Importantly, both outputs of the filter are connected; otherwise, the exception would not be thrown. In this particular example, the on-false output is connected to the exception, while the on-true output is connected to the target component.

© 2018-2024 Altova GmbH