AnsweredAssumed Answered

How to modify a target step's row meta structure from the code of my UDJC step (which is the source step)?

Question asked by Paulo Lima Employee on Nov 21, 2017
Latest reply on Dec 13, 2017 by Joao Figueiredo

Hi there,


In my UDJC code, I have retrieved the target step meta like this:


StepMeta myTargetStepMeta = getTransMeta().findStep(getParameter("MY_TARGET_STEPNAME"));


There is a hop between my UDJC step (source step) and the target step (myTargetStepMeta).

In the beginning of the processRow() method's code in my UDJC step, I am constructing the new row meta structure by calling this method below (addField) inside the code of an "if (first){ ... }" block. Now, how do I associate the generated row meta structure (RowMetaInterface object) with my target step (myTargetStepMeta)? 


private void addField(RowMetaInterface row, String fieldName, int type, int length, int precision) throws KettleStepException {

    try {

      ValueMetaInterface value = ValueMetaFactory.createValueMeta( fieldName, type, length, precision );

      value.setOrigin( myTargetStepMeta.getName() );

      row.addValueMeta( value );