Altova FlowForce Server 2025 Advanced Edition

MapForce Mapping as a Scheduled Job

Home Prev Top Next

This tutorial will show you how to deploy an Altova MapForce mapping to FlowForce Server and run this mapping as a scheduled job. The broad outline is described below:

 

1.We will first deploy a MapForce mapping to FlowForce Server. After we have configured all the relevant deployment settings, the browser will display the job configuration page that will already include the deployed mapping as an execution step.

2.After that, we will add an execution step that will check if the path of the mapping output exists.

3.In the next step, we will add a conditional step that will create a directory for the mapping output if this directory does not exist.

4.Then we will configure a timer that will trigger the job according to a specific schedule.

5.We will also select an existing password credential, with which the job will be run.

6.After the job has been executed, we will check the output directory for the file produced by the mapping.

 

Required licenses

Note that you must have the following licenses for this job configuration: MapForce Enterprise Edition, MapForce Server Advanced Edition, and FlowForce Server.

 

Implementation

This subsection describes step-by-step instructions on how to create the job outlined above. The implementation of this scenario is also shown in the GIF file at the bottom of this topic.

 

Step 1: Deploy MapForce Mapping to FlowForce Server

For this tutorial, we will use an example that is shipped together with MapForce:

 

<Documents>\Altova\MapForce2025\MapForceExamples\BookCatalogPDFToXML.mfd

 

Open this file in MapForce and proceed as follows:

 

1.Open the File menu and select Deploy to FlowForce Server.

2.In the Deploy Mapping dialog that pops up, enter the relevant connection details.

3.Leave the default path of the deployed mapping and other settings as is.

4.Click OK.

5.The deployed mapping will open on the job configuration page of the FlowForce Server administration interface, as an execution step. Click the plus icon next to the Working Directory parameter and enter the following path: C:\Test\FlowForceServer\MapOutput. This is the path where the file produced by the mapping will be saved.

 

Step 2: Add an execution step that checks if a path exists

In the next step, we want to check if the output directory that will store the file produced by the mapping exists. In order to do this, follow the steps below:

 

1.Click the plus icon above the step with the deployed mapping and select New Execution Step. The execution step's block will appear.

2.Browse for the /system/shell/commandline function in the Execute function field. This system function can execute shell commands and batch files.

3.Enter the following command in the Command parameter:

 

IF EXIST C:\Test\FlowForceServer\MapOutput (ECHO true) ELSE (ECHO false)

 

This command checks if the output directory exists. If the directory exists, the command will return true; if not, the command will return false.

 

4.Type output in the Assign the step's result to field. By doing so, we assign the result of the step to the value output of type result. Assigning the step result is necessary, because this way, we will be able to use the result of this step in the next step.

 

Step 3: Add a Choose step

Next, we need to add a conditional step that will create the output directory if it does not exist. Take the steps below:

 

1.Add a Choose step as follows: Click the plus icon after the first execution step and select New Choose Step. The Choose block will appear.

2.In the When field, type the following expression:

 

trim(content(stdout(output))) == 'false'

 

The stdout function takes the result produced by the previous execution step and outputs a stream. The content function converts the stream to a string. After that, the trim function removes all leading and trailing spaces from the string.

 

The reason for converting the output to a string is because we want to check if the output is equal to the string false. To be able to compare the two parts of the expression, we must make sure both parts are of the same data type.

 

The reason for trimming the string is because standard output may contain leading and trailing spaces that are preserved when we convert the stream to a string. Without the trim function, the result of the left part of the expression may not be equal to the string false.

 

3.Add an Execution step in the When part of the Choose step: Click the plus icon and select New Execution Step.

4.Browse for the /system/filesystem/mkdir function in the Execute Function field.

5.Add the following path to the Path parameter: C:\Test\FlowForceServer\MapOutput.

6.Leave the Otherwise part of the Choose block as is.

 

If the output directory does not exist, the Choose step will create it. If the output directory exists, the Choose step will not be executed, and job execution will proceed with the mapping.

 

Step 4: Configure a timer that will trigger the job

Since we want to run the job according to a particular schedule, we need to set a timer that will trigger the job. To add a timer, take the steps below:

 

1.Navigate to the Triggers section of the job configuration page and select New Timer.

2.Set the Run option to Days of Week.

3.Set the day(s) on which the job will run. In our example, the job will run every Thursday.

4.Set the start date and time in the Start parameter.

5.Make sure the Enabled check box is selected.

 

Step 5: Add a credential

When you create a job in FlowForce Server, you must supply the credentials of the user account with which the job must be executed.

 

In the Credentials section, we will select a password credential that we created before starting this tutorial. This is a standalone credential object that you can use in any job. Standalone credentials are convenient, because you can change them in one place, and this change will affect all jobs that use that credential reference.

 

Alternatively, you can specify a local credential, by entering your user name and password.

 

For more information about types of credentials and instructions on how to create them, see Credentials.

 

Step 6: Save job configuration and check output

To save the job configuration, click Save at the bottom of the configuration page. As soon as the trigger fires, the job will be executed. To see the output, navigate to C:\Test\FlowForceServer\MapOutput and check if it contains BookList.xml. You can also check the log for details about the execution of the job. An excerpt of the BookList.xml file is given below:

 

<BookList xsi:noNamespaceSchemaLocation="BookList.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<Book ISBN13="1501143107" Title="Misery" Year="2016" Price="11.99">

         <Author>Stephen King</Author>

</Book>

<Book ISBN13="9781910633113" Title="Nightblind" Year="2016" Price="9.99">

         <Author>Ragnar Jonasson</Author>

</Book>

<Book ISBN13="1910633461" Title="Blackout" Year="2016" Price="8.49">

         <Author>Ragnar Jonasson</Author>

</Book>

<Book ISBN13="1501180983" Title="Outsider" Year="2018" Price="12.79">

         <Author>Stephen King</Author>

</Book>

<Book ISBN13="9781435142817" Title="Dracula" Year="2013" Price="13.69">

         <Author>Bram Stoker</Author>

</Book>

<Book ISBN13="9781400043286" Title="The Mystery of Edwin&#xa;Drood" Year="2004" Price="19.79">

         <Author>Charles Dickens</Author>

</Book>

<...>

</BookList>

 

Implementation shown in GIF

For a quick demo of the steps described in this tutorial, please click the GIF file below. Note that only Steps 1-4 and 6 are illustrated in the GIF. For an illustration of Step 5, see the Hello World tutorial.

Click to play

 

© 2018-2024 Altova GmbH