US and Worldwide: +1 (866) 660-7555
Results 1 to 2 of 2

Thread: TableInputMeta.setVariableReplacementActive(true) does not work for DBconnection?

  1. #1
    Join Date
    Dec 2011
    Posts
    4

    Default TableInputMeta.setVariableReplacementActive(true) does not work for DBconnection?

    Hello,

    we are generating transformations using Java. Now we have a transformation that gets its data from a table input step:

    // create the source step...
    TableInputMeta tii = new TableInputMeta();
    tii.setVariableReplacementActive(true);
    tii.setDatabaseMeta(sourceDBInfo);
    tii.setSQL(SQLQuery);
    tii.setLazyConversionActive(true);
    String fromstepid = registry.getPluginId(tii);
    StepMeta fromstep = new StepMeta(fromstepid, SrcTabName,(StepMetaInterface) tii);
    fromstep.setLocation(150, 100);
    fromstep.setDraw(true);
    fromstep.setDescription(SrcTabName);
    transMeta.addStep(fromstep);

    The problem here is that even that we can see that the "Replace variables in script?" variables is set (tii.setVariableReplacementActive(true)), then this does not apply for the variables in the database connection (we get "You need to specify a database connection." at runtime). If i open the transformation in Spoon, remove the "Replace variables in script?" flag and put it back, then it works also for the database connection.

    Is it a feature or a bug? How can we generate set the "Replace variables in script?" to true so that also the DBconnection variables are replaced?

    Br,
    Jaanus
    Last edited by MattCasters; 08-03-2012 at 05:42 AM.

  2. #2
    Join Date
    Nov 1999
    Posts
    9,534

    Default

    You need to share the variables of the database connection with the ones from the transformation.
    Something like:

    Code:
    sourceDBInfo.shareVariablesWith(transMeta);
    or with another VariableSpace ofcourse.
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •