Handling Data Types in Steps

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

Home >  Configuring Jobs >

Handling Data Types in Steps

When you pass the result of one step to another step or job, you will most likely need to change the data type of the step result. For example, if you create a step that lists the contents of a directory, the return type is result. In order to be able to process this result in a particular way (for example, to send it an email, or to write it to a file), you need to convert it from result to stream or to string.

 

You can change the return type of a step (let's call it step 1) as follows:

 

1.Type a value in the Assign this step's result to field of step 1. You will need to refer to this value later in order to access the result of the step.
2.Add a new execution step after step 1 (let's call it step 2).
3.Set the builtin_functionsystem/compute built-in function as execution function of step 2.
4.In the Expression field of step 2, type an expression which converts the value returned by step 1 into the required data type. For example, if the value returned by step 1 is a command line result that returns some output, and if you want to convert it to stream, use:

 

stdout(result)

 

Where result is the name you gave to the value returned by step 1.

 

The exact expression to use depends on the result you want to achieve. FlowForce Server provides various expression functions which you can combine with operators and produce meaningful expressions for use in steps. To understand the available options, see Step Result Functions.

 

Example

Let's assume that you have created an execution step which lists the contents of a directory, as follows:

fs_clip0004

At this stage, the output of the step is a result. To use this result in other steps (which could, for example, write the directory contents to a file, or send an email with its contents), you need a return value of type stream, not result.

 

 

To convert the output of the directory listing step to "stream" data type:

1.Declare the result of the step 1 as Step1Output. To do this, type Step1Output in the Assign this step's result to field.
2.Add a new execution step which calls the builtin_functionsystem/compute function.
3.Under Parameters, enter the following expression: stdout(Step1Output), where step1output is the result of step 1.

fs_clip0001

At this stage your job output data type is stream, as intended. You can now create a new execution step that will send the result of the second step to an email address.

 

 

To send the directory listing to an email address:

1.Change the expression of step 2 from stdout(Step1Output) to content(stdout(Step1Output)). By doing this, you are converting the stream value into a string value.
2.Declare the result of step 2 as Step2Output. To do this, type Step2Output in the Assign this step's result to field.
3.Add a new execution step (step 3), with the following settings (note that the mail server settings must be configured before you can use the built-in builtin_function/system/mail/send function):

 

Execute function

Browse for the builtin_function/system/mail/send function.

From

Enter the sender's email address.

To

Enter the destination email address.

Subject

Enter the subject of the email, for example "Directory Listing".

Body

Click ff-setTo, and then select Step2Ouput.

 

At this stage, the execution steps should look as follows:

fs_clip0002

4.Create a timer trigger that will run the job either once or periodically (for example, every 60 minutes).

fs_clip0003

5.Click Save.

© 2019 Altova GmbH