Let's create a more flexible version of the job you did in the previous section.
HELLOFOLDER
. Insert chapter10
as the default value. yourname
. Select command line argument 1
as the Type. String
field named message
. As Formula, type"Hello, " & [yourname] & "!"
. ${LABSOUTPUT}/${HELLOFOLDER}/hello
as the name of the file. transformations
folder you created in the previous tutorial, under the name hello_world_param.ktr
. hello_world.kjb
job you created in the previous tutorial and save it under a new job named hello_world_param.kjb
. ${LABSOUTPUT}/${HELLOFOLDER}
. ${Internal.Job.Filename.Directory}/transformations/hello_world_param.ktr
. my_folder
, which you initially specified as a named parameter, should be created. hello.txt
. This time the content of the file has been customized with the name you provided:Hello, pdi student!
You created a transformation that generated a hello.txt
file in a folder given as the named parameter. The content of the file is a customized "Hello" message that gets the name of the reader from the command line.
In the main job you also defined a named parameter, the same that you defined in the transformation. The job needs the parameter to create the folder.
When you run the job, you provided both the command-line argument and the named parameter in the job dialog window that shows up when you launch the execution. Then a folder was created with the name you gave, and a file was generated with the name you typed as argument.
You can use named parameters in jobs in the same way you do in transformations. You define them in the Job properties window. You provide names and default values, and then you use them just as regular variables. The places where you can use variables, just as in a transformation, are identified with a dollar sign to the right of the textboxes. In the tutorial, you used a named parameter in the Create a folder job entry. In this particular example, you used the same named parameter both in the main job and in the transformation called by the job. So, you defined the named parameter HELLOFOLDER
in two places—in the Job settings window and in the Transformation properties window.
3.139.103.27