Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How do I access result data in a Kettle job?

  1. #1
    Join Date
    Sep 2015

    Default How do I access result data in a Kettle job?

    I'm trying to understand the capabilities of Kettle jobs, and how to pass values from one step to the next.
    This is my scenario:
    A csv file is received, which triggers a scheduler to invoke kitchen from the command line, passing "/param:INPUT_FILE=%SCHEDULER_ORDER_ID%" as one of the command line arguments.
    Inside the job, I am able to use ${INPUT_FILE} in an SQL task in the body of the SQL Script, that inserts a row in a log table, identifying the received file. So far, so good.
    I then run a transformation which has "Pass all parameter values down to the sub-transformation". The underlying transformation is able to use this value as ${INPUT_FILE} in the Filename value of a CSV Input widget. Still fine.
    The transformation produces a .tmp file, then the next task in the parent job is a Shell script, which runs a .cmd file that invokes a VB script that creates a .txt file from the .tmp file. Still fine.
    Here's where I'm not sure what to do.
    I want to insert another row in the log table, for the .txt file just produced.
    It looks like the "Add filenames to result" widget is a good choice, where I can specify a Folder and a Wildcard, to get the name of the .txt file just produced.
    What is not clear to me is how to access this "result" in a subsequent SQL task.
    Any help is appreciated.
    Last edited by edtguy; 03-15-2016 at 04:14 PM. Reason: add keywords

  2. #2
    Join Date
    Sep 2015


    I've found an alternative approach that solves my issue.
    Instead of using the "Add filenames to result" widget in the job and trying to access the result value in an SQL widget in the job, I call out to another transformation.
    In that transformation, I use a "Get File Names" widget, where I set the directory and wildcard values for the name of the file I want to retrieve, then I access the result in a "Execute SQL Script" widget, where I've checked "Execute for each row" and use short_filename in a parameter substitution in my SQL script.
    I'm not sure if this is the most efficient way to address this, but it's working for me.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.