Customer Portal

Call a select statment for each record

Comments 1

  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hi ponderena,

    if you want to do some query on the database, you can prepare your statement e.g. in a Reformat component with CTL code as following:

    function integer transform() {
    $out.0.query = "select nvl(max(days),0) from table where key = " + $in.0.key;

    return OK;
    }

    Then you can query your database with a DBInputTable with Query URL set to port:$0.query:discrete. You can process the output records and insert it into the database again with a DBOutputTable component.

    If your question was meant more generally and you want to know how similar procedure can be done in CloverETL enviroment, you can achieve it for example this way:

    max() is an aggregate function so you can use an Aggregate component. Aggregate key will be your abovementioned key.
    nvl() can be replaced by a simple Reformat with CTL code like:

    if ($in.0.field1 == null) {
    $out.0.field1 = 0;
    }

    If something was unclear to you, please, let me know.

    Best regards,

Please sign in to leave a comment.