5 Replies Latest reply on Jan 15, 2020 12:30 PM by Nico Heinze

    Expression Transformation - decimal to fixed size char representation of decimal

    Thomas Embich New Member



      This may be an elementary question but the issue has me in a quandary on how to handle it.


      I have a decimal field which needs to go to a target text file with a fixed zero padded characteristic and mantissa on either side of the decimal (customer request).


      The input decimal field may be 154.1  and need to go to the target text file as '00000154.10'   Always 8 positions in the characteristic and 2 positions in the mantissa.


      The solution I've been going with is to convert the decimal to a char and pull apart the field and LPAD the characteristic and RPAD the mantissa then reassemble them for the final fixed zero padded 11 position field.


      My quandary is how to handle in-line variables representing LENGTH, INSTR position of the decimal char, and respective sizes of the characteristic and mantissa.  Should I create variable ports for each or is there a way (and this belies my inexperience with PowerCenter) to create in-line variables in the expression for a port?