pjs.editCode()
Â
The pjs.editCode() API converts a number to characters using an edit code. If length and decimal positions are not passed to the API, the length and decimal positions are derived automatically based on the field configuration (if a declared field is used as the first parameter) or based on the result of an expression (if an expression, constant, or a variable without a strong data type is used).
The following tables shows the list of available edit codes.
Edit Code Description | No Sign | Cr Sign | -Sign(R) | -Sign(L) |
---|---|---|---|---|
Commas and zero balances | 1 | A | J | N |
Commas | 2 | B | K | O |
Zero balances | 3 | C | L | P |
No commas or zero balances | 4 | D | M | Q |
User-defined edit codes | 5 - 9 | Â | Â | Â |
Hexadecimal F sign | X | Â | Â | Â |
Date edit | Y | Â | Â | Â |
Suppress leading zeros | Z | Â | Â | Â |
Parameters
Number
Edit code
Currency Symbol or Asterisk Fill (Optional)
OR
Number
Edit code
Length
Decimal positions (Optional) - if omitted, 0 is assumed
Example
Â
pjs.define("num", { type: 'decimal', length: 7, decimals: 2, initValue: -12345.14 });
pjs.define("result", { type: 'char', length: 52, varying: true });
result = pjs.editCode(num, 'B', '$');
//$12,345.14CR
Â
RPG EquivalentÂ
%EDITC()