Customer Portal

creating a new record (row) transformation help

Comments 1

  • Avatar
    David Pavlis
    0
    Comment actions Permalink

    Hi Mahmood.

    If, basically, you need to create 1 or more records out of 1 input, then the component which can help with this is Normalizer.

    It requires two CTL functions to be defined:

    • count() - supposed to return a number which denotes how many (X) times will the second function be called for the current input record
    • transform(integer idx) - function called X times for each input record (idx starts with 0, then up to X-1)

    Example:

    function integer count(){
    if ($in.0.IDT-TYPE == '001') {
    return 2; // transform called 2x
    }else{
    return 1; // transform called 1x
    }
    }

    function integer transform(integer idx){
    switch(idx){
    case 1:
    $out.0.value="A";
    break;
    case 2:
    $out.0.value="B";
    break;
    default:
    $out.0.value="AB";
    }
    return OK;
    }

    Your logic in count() can be quite complex. If you need to, aside calculating how many output records should be created, some other logic, then you can use global variable which you populate in the count() function or just calculate it inside tranform(integer idx) function.

Please sign in to leave a comment.