Create a Job from a StyleVision Transformation

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Job Configuration Examples >

Create a Job from a StyleVision Transformation

This example shows you how to create a FlowForce Server job from a StyleVision transformation. First, you will deploy a demo transformation file from StyleVision to FlowForce Server. Deploying a transformation file means that StyleVision organizes the resources used by the transformation into an object and passes it to FlowForce Server. Once the transformation is deployed to FlowForce Server, you will create a server job from it. The job will consist of three steps, namely:

 

1.The first step will execute the StyleVision transformation.
2.Because the transformation returns an array of multiple streams, the second step will access one of the several files created by the transformation, using a FlowForce Server expression.
3.The third step will copy the file to an archive folder.

 

Prerequisites

Required licenses: StyleVision Enterprise or Professional edition, StyleVision Server, FlowForce Server
FlowForce Server is running at the configured network address and port (see Setting the Network Address and Port)
You have a FlowForce Server user account with permissions to one of the containers (by default, the /public container used in this example is accessible to any authenticated user).
On the operating system where FlowForce Server runs, the following directories must exist and you must have rights to create files in them:
oc:\archive
oc:\temp

 

Demo files used

AutoCalc.sps, available at the following path relative to the StyleVision examples project: Examples > Basics AutoCalc.sps. (To open the StyleVision examples project in StyleVision, click Examples on the Project menu.)

 

Creating the job

1.Open the AutoCalc.sps file in StyleVision.
2.On the File menu, click Deploy to FlowForce.... If this option is disabled, make sure the Design tab is currently selected.
3.When prompted to save the transformation as PXF file, leave the default settings as is, and click OK.
4.Enter the server name and port of the Web administration interface in the respective fields (for example, localhost and 8082, if FlowForce Server is running on the same machine at the default port).
5.Enter your FlowForce Server user name and password, and, next to Login, leave the Default option as is.

 

If Directory Service integration is enabled, enter your domain user name and password, and then select your domain name from the Login drop-down list. For more information, see Changing the Directory Service Settings

DeployStyleVisionDlg

6.Make sure the Open web browser to create new job check box is selected. Although you can change the path where the transformation should be deployed, for the purpose of this example, leave the selected path as is.
7.Click OK. When deployment finishes, the FlowForce Server Administration Interface opens in your web browser, and a partially filled in job page is displayed. As shown below, an execution step is created automatically with some pre-filled parameters.

fs_stylevision_example2

Note:The option GenerateHtmlOutputAsMime is not selected in this example. This option is typically necessary to prepare the HTML body of an e-mail message sent with FlowForce Server. For more information, see the send-mime function.
8.Next to Parameters / OutHtml, click the add button. This declares the AutoCalc.html as output file.
9.In the Assign this step's result box, enter step1. This instructs FlowForce Server that the result returned by the first execution step of the job has the name step1. We will need to refer to this result subsequently.
10.In the Working-directory box, enter the path to a directory where FlowForce Server must save the job output. This example uses c:\temp as working directory.

 

A working directory is a parameter required by execution steps if the job needs a location to unpack any input files or save output files. FlowForce Server also uses the working directory to resolve any relative paths that occur during step execution. When asked to provide a working directory, you should supply a valid path on the operating system where FlowForce Server runs. If you do not supply a working directory when creating the step, FlowForce Server uses a temporary directory.

 

11.Under the execution step that is already created, click new Execution step and configure the step as follows:

 

Execute function

Browse for the builtin_function/system/compute function.

Expression

Enter the following FlowForce Server expression:

as-file(nth(results(step1), 0))

This expression instructs FlowForce Server to do the following:

1.Call the expression function results to get the array returned by step1 declared previously.
2.Pass this array to function nth to get the first item in the array. Since the array index is zero-based, we are using 0 as second argument of function nth.
3.Pass the value to function as-file to declare it as a file.

Assign this step's result to

Enter step2. This instructs FlowForce Server that the result returned by the step has the name step2. We will need to refer to this result subsequently.

 

12.Click new Execution step and configure the step as follows:

 

Execute function

Browse for the builtin_function/system/filesystem/copy function.

Source

Click ff-setTo, and then select step2.

Target

c:\archive\AutoCalc.html

Overwrite

Select the Overwrite check box.

Working directory

c:\temp

 

At this stage, the Execution Steps section of the job page should look as follows:

ExampleStyleVision3

13.Under Triggers, click new Timer.
14.Next to Run, set the timer to run Daily every 1 days. Next to Start, select a date and time when the job must start, for example:

ExampleStyleVision4

15.Under Credentials, select an existing credential record or specify a local credential (see also Credentials).

 

A credential record is the combination of user name and password associated with a user account on the operating system where the FlowForce Server job runs. When you define a job in FlowForce Server, you must supply the credentials with which the job must be executed. Note that if the user account associated with the supplied credentials does not have sufficient rights on the operating system, the job cannot execute successfully.

ff-trig1a

16.Click Save. At the time and date specified in the trigger, FlowForce Server executes the StyleVision transformation job. If the job executes successfully, the AutoCalc.html file becomes available in the c:\archive directory. To see whether the job executed successfully, refer to the job log (see Viewing the Job Log).

© 2019 Altova GmbH