Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

When applying a function to different items in a schema or database, MapForce needs to know what the context node will be. All other items are then processed relative to this one. This is achieved by designating the item (or node) as the priority context.


Priority-context is used to prioritize execution when mapping unrelated items.


Mappings are always executed top-down; if you loop/search through two tables then each loop is processed consecutively. When mapping unrelated elements, without setting the priority context, MapForce does not know which loop needs to be executed first, it therefore automatically selects the first table, or data source.



Decide which table, or source data is to be looped/searched first, and then set the priority context on the connector to that table.


A simplified version of the complete DB_CompletePO.mfd file available in the ...\MapForceExamples folder, is shown below.


Note that there are multiple source components in this example. ShortPO is a Schema with an associated XML instance file, while CustomersAndArticles is a database. The data from both are then mapped to the CompletePO schema / XML file. The priority context icon is enclosed in a circle as a visual indication.


Designating the a parameter of the equal function as the priority context would cause:


The CustomerNr in ShortPO is compared with the item Number in the database.

CustomerNr has been designated as the priority context, and is placed in the a parameter of the equal function.


The CustomersAndArticles database is then searched (once) for the same number. The b parameter contains the Number item from the database.

If the number is found, then the result is passed to the bool parameter of the filter component (Customers).

The node/row parameter passes on the Customer data to "on-true" when the bool parameter is true, i.e. when the same number has been found.

The rest of the customer data is then passed on as: Number, FirstName, LastName items, are all connected to the corresponding items in the target schema.


This means that the database is only searched once per CustomerNr supplied by ShortPO.


Designating the b parameter of the equal function as the priority context would cause:


MapForce to search and load the first Number into the b parameter from the database

Check against the CustomerNr in the a parameter of ShortPO

If not equal, search through all CustomerNr of ShortPO

Search the database and load the next Number into b, check against a, and

Iterate through every Number in the database while trying to find that number in ShortPO.



This means that a database query is generated for each Number and the result is then compared to every CustomerNr of ShortPO.


Priority context and user-defined functions

If a user-defined function has been defined of type "inline", the default setting, then a priority context cannot be defined on one of the parameters of the user-defined function. The user-defined function can, of course, contain other regular (non-inlined) user-defined functions which have priority contexts set on their parameters.

© 2019 Altova GmbH