Customer Portal

if statement in trasformation of ExtMergeJoin

Comments 1

  • Avatar
    slechtaj
    0
    Comment actions Permalink
    Hi,

    First of all you should keep in mind that mapping cannot be done in return statement, which is used for output port selection. Your example might look like this (of course I don't know your metadata on output port):

    function integer transform() {
    // If $in.1.Amt is null then put NULL into output field SomeOutputField
    // Otherwise set $in.1.Amt = ($in.0.Percent * $in.1.Amt)
    $out.0.SomeOutputField = isnull($in.1.Amt) ? null : ($in.0.Percent * $in.1.Amt);
    return ALL;
    }

    Also you should keep in mind, the transform() is supposed to return integer. This integer value is actually always the port number (0, 1, 2, ... , 2147483647) with one exception - that is number 2147483647, which stands for all ports. Let me give you an example:

    function integer transform() {
    $out.0.yourOutputField= $in.0.yourInputField;
    $out.1.yourOutputField= $in.0.yourInputField;
    return 1;
    }

    The first two row of the transform function map data to both output ports (0, 1). However, on the third line, there is "return 1", which means data will actually be sent only to the output port number 1 (which is the second output port). That means although you have defined some mapping for the first output port (output port number 0), data is not send to this port since using the return statement you decided to use only the second output port. If you would like to send data to both ports, you would have use one of these values: 2147483647, ALL.
    For more information on this topic please refer to Return Values of Transformations chapter of this article in our documentation.

    Hope it helps.

Please sign in to leave a comment.