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)

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
  1. Number

  2. Edit code

  3. Currency Symbol or Asterisk Fill (Optional)

OR

  1. Number

  2. Edit code

  3. Length

  4. 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()