Customer Portal

If Statement in Reformat Component

Comments 1

  • Avatar
    admin
    0
    Comment actions Permalink
    Hi,

    In the CloverETL tool, the only thing you should keep in mind is the way how you refer to the variables in all transformations. I mean, you should define what input/output port and field name you are referring to. Your code in Reformat component would then look as follows:

    function integer transform() {
    if ($in.0.num1 == 1 || $in.0.num2 == 1)
    {
    $out.0.num =1;
    }
    else
    $out.0.num = 0 ;
    return ALL;
    }


    The "$in.0num1" variable means that the value is taken from the field called "num1" (defined in appropriate metadata) and it is coming from input port 0.

    For more information please see the documentation http://doc.cloveretl.com/documentation/ ... ditor.html.

    Or you can also review the attached example. Please note that in the example graph I have decided to define output metadata to be of boolean data type, therefore the resulting transformation slightly differs.

    Hope this helps. Best Regards.

    Eva

Please sign in to leave a comment.