Customer Portal

Handle error in reformat component

Comments 4

  • Avatar
    oldforum
    0
    Comment actions Permalink
    Yes, this is a simple work around for my secific problem. I posted it just as an information, to say that my work goes on, and the way it goes.
    In fact I encounter the problem you discribe : I needed to remove the "not nullable" attribute of metadata to have this solution works. The nullity check of source data is made before, in a "normalizer" component.

    Well, it's just a (perfectible) tips for my problem, and it is cool that it rises some response. Of course, I eventually search a better solution :)

    Francois
  • Avatar
    oldforum
    0
    Comment actions Permalink
    What if the interface definition of RecordTransform would change to return not false-true but number.
    That could be used like this:

    -1 (or negative number) - error
    0 - O.K. send the out records
    >0 (positive number) indicates the one output port through which data will be sent (all others receives nothing)

    Anyway, this is more a development discussion - we should move it to different forum.

    David
  • Avatar
    oldforum
    0
    Comment actions Permalink
    Ok, I find a solution replacing this code in Reformat :
    ---------
    if (transformation.transform(inRecord, outRecord)) {
    for(outPort=0;outPort<numOutputPorts;outPort++){ writeRecord(outPort, outRecord[outPort]);
    }
    }
    }// skip record if transformation returned false
    ---------
    By this one :
    ----------
    if (transformation.transform(inRecord, outRecord)) {
    for(outPort=0;outPort<numOutputPorts;outPort++){
    if(!outRecord[outPort].isNull()) {
    writeRecord(outPort, outRecord[outPort]);
    }
    }
    }// skip record if transformation returned false
    ----------
    And in the java transformation class, if a transformation fails, I set the standard (0) output to null thanks to outputRecord[0].setToNull() and copy input to the error output (1).

    If it may help others...
  • Avatar
    oldforum
    0
    Comment actions Permalink
    Hello,
    this solution could be suitable for your proprietary issue, but isn't generally recommended, for DataRecord.setToNull() could throw NullPointerException if some field is not nullable and simultaneously has not default value defined. In short, this way is not possible for some type of metadata.

    Martin

Please sign in to leave a comment.