Customer Portal

try/catch block in TL

Comments 1

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hello,
    the problem is, that CTL1 allows mapping as the last statement only, so you need to move the mapping to separate function:
    //#TL
    string message;
    string errMsg;

    function mapValores(){
    $0.valores := iif(isnull($0.valores), null, num2str($valores));
    }

    function transform() {
    try{
    mapValores();
    return 0;
    }catch (errMsg) {
    message = 'Failed for field $0.valores value '+$0.valores+' msg '+errMsg;
    return -1;
    }
    }

    function getMessage() {
    return message;
    }

Please sign in to leave a comment.