Customer Portal

Pls a example of a use "If"in a REFORMAT

Comments 7

  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hi, grojas123,

    Can you use something like this?

    if (isnull($in.0.srp) || $in.0.srp == 0) {
    return $in.0.srp_ref;
    } else {
    return $in.0.srp;
    }

    For more details, see http://doc.cloveretl.com/documentation/ ... -ctl2.html

    Best regards,
  • Avatar
    grojas123
    0
    Comment actions Permalink
    Tks
  • Avatar
    grojas123
    0
    Comment actions Permalink
    That code give that error "Syntax error on token 'if'"
  • Avatar
    grojas123
    0
    Comment actions Permalink
    Even I try that IF (isnull($in.0.srp_ref) || $in.0.srp_ref == 0) $in.0.srp; else $in.0.srp_ref; but show me the error Syntax error on token '$in.' in $in.0.srp
  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hello again,

    Which version of Designer do you use? There was different syntax in the older versions. Try $0.srp instead of $in.0.srp. But if you have version 3.2 or newer, your issue lies probably in some typo in CTL. Please, send me the whole CTL code of Reformat in this case so I could find the typo. Thank you.

    Best regards,
  • Avatar
    grojas123
    0
    Comment actions Permalink
    I use the Version: 3.4.0.029M2
    I I code only that
    If (isNull($in.0.srp)) no issues but When I try put the a other part of the code
    If (isNull($in.0.srp)) $in.0.srp_ref; a error in "Syntax error on token '$in.'"
    When I finish the code:
    If (isNull($in.0.srp)) $in.0.srp_ref; else $in.0.srp;
    Show me same error.
    "Syntax error on token '$in.'" and point on $in.0.srp_ref
    When I try IF (isNull($in.0.srp)) { return $in.0.srp_ref; } { else return $in.0.srp;}
    Show me a error in a syntax error in first , third, four "{"
    Even when I try just
    If (isNull($in.0.srp)) $in.0.srp_ref;
    a error in "Syntax error on token '$in.'"
  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hi,

    There are some issues in your CTL:
    1. isnull(object) and isNull(record, integer) are not the same functions. CTL is case sensitive.
    2. The same thing with control statements (If, IF, if) - only lower case if is the proper usage.
    3. You have a mistake in brackets in the control statement:
    right: if () {} else {}
    wrong: if () {} {else}
    4. Syntax in your line If (isNull($in.0.srp)) $in.0.srp_ref; else $in.0.srp; is also wrong - $in.0.srp and $in.0.srp_ref are names of the variables, not the whole commands.

    Please, take a look on this http://doc.cloveretl.com/documentation/ ... /ctl2.html and you can also use content help and Available Functions button in Transform editor.

    Best regards,

Please sign in to leave a comment.