Step Result
There are situations in which you may need to use the result of a step in some other step. In order to do this, you will need to assign the step result to a value of a particular data type (e.g., of type result). The data type depends on the step function you choose to execute.
To be able to use a step's result in some other step, you must make sure the data types of these steps are the same. Therefore, you will most likely need to change the data type of the step result before being able to use this result in some other step. See the example described below.
Example
Our sample job has an execution step which lists files and directories located on the C drive (Step 1 in screenshot below). Our goal is to send the directory listing by email. Follow the instructions below.
1.Create an Execution step (Step 1 in screenshot below).
2.Browse for the /system/shell/commandline function.
3.Type dir in the Command parameter.
4.Type C:\ in the Working Directory field.
5.Assign the result of Step 1 to Step1Output: Type Step1Output in the Assign this step's result to field (circled in red below). The step's result is of type result. Assigning the result produced by the dir command to Step1Output will enable you to use this result in the second execution step.
6.To send the directory listing by email, we will use the /system/mail/send function. Since the Message body parameter in this function is of type string (see Step 3 in Send by Email), we need to convert the value Step1Output of type result to string. Therefore, add a new execution step which calls the /system/compute function and enter the following expression in the Expression parameter: content(stdout(Step1Output)). In this expression (circled Expression in Step 2 below), the stdout function takes Step1Output as its parameter and produces an output stream. The stream is then converted to a string by means of the content function.
7.Assign the result of Step 2 to Step2Output. We will refer to this value in the /system/mail/send function.
8.Add a new execution step, as shown in the screenshot below. Before using the /system/mail/send function, you must configure the mail server settings.
9.The last steps are to add a trigger that will fire the job, enter your credential with which the job will be run, and save the job configuration.