Format Codes

Introduction

Numeric fields are stored in the database without any formatting whatsoever. Apply format (sometimes called edit codes as well) codes to numeric fields allows you to add formatting to make your numerical values more readable for your end-user. For instance instead of showing your user a value of 9876532, a format code would allow you to instead show the value as $9,876,532. The value, of course is the same but the additional formatting makes it much easier to quickly read and better understand the value.

m-Power ships with many format codes by default (see table below), but you can also create your own custom format codes as well.

Overview

Defined edit codes are stored in a text file /mrcjava/mrcclasses/editcode.txt which includes default and mrc pre-defined codes. The mrc pre-defined codes are called user defined code, so you can either change or define your new edit code within this section.

Summary of Default Edit Codes

Edit Code NameCommasDecimal pointSign for NegativeDecimal or BlankPositive ExampleNegative Example
NoneNo No No Sign12345671234567
1Yes Yes No Sign.00 or 012,345.6712,345.67
2Yes Yes No SignBlanks12,345.67 12,345.67
3No Yes No Sign .00 or 0 12345.6712345.67
4No Yes No Sign Blanks12345.6712345.67
AYes Yes CR .00 or 0 12,345.6712,345.67CR
BYes Yes CR Blanks12,345.67 12,345.67
CNo Yes CR .00 or 0 12345.6712345.67CR
DNo Yes CR Blanks12345.6712345.67CR
JYes Yes – (minus) .00 or 0 12,345.6712,345.67-
KYes Yes – (minus)Blanks12,345.6712,345.67-
LNo Yes – (minus) .00 or 0 12345.6712345.67-
MNo Yes – (minus) Blanks12345.6712345.67-
YNo No No Sign 12345671234567
ZNo No No Sign 12345671234567
NYes Yes – (floating) .00 or 012,345.67-12,34567
OYes Yes – (floating) Blanks12,345.67-12,34567
PNo Yes – (floating) .00 or 0 12345.67-12345.67
QNo Yes – (floating) Blanks12345.67-12345.67

All edit codes displayed above suppress the printing of leading zeros.

Specifying Your own Edit Word

The following is a brief explanation of the rules for defining an edit word.

— Any character other than a space, ampersand (&), zero, asterisk (*), decimal point (.), comma (,), minus sign (-), or CR will be treated as a literal and will be printed wherever it occurs.

— No literal will be printed which occurs to the left of the first significant digit in a number.

— A blank in the edit word will be replaced with the digit from the corresponding position of the data field.

— An ampersand will be replaced by a space.

— To stop suppression of leading zeros, place a zero or an asterisk in the farthest right position where zero suppress is to stop. A zero will cause leading zeros to be replaced with spaces. An asterisk will cause leading zeros to be replaced with asterisks.

— Either a minus sign or CR may be used to indicate a negative number. Whichever one is used, it must appear to the right of the last digit in the number. If a number is positive, the minus sign or CR will be replaced by spaces.

— Commas or decimal points which occur to the left of the first significant digit of a number will not be printed.

As an example of how these rules are applied, the following is the edit word customer account number where the first six digits are the base customer number and the last three digits are a location code:

0____-___ where the underscores indicate spaces.

The zero indicates that leading zero suppression stops in the first digit of the customer number. The minus sign is treated as a literal since it is not to the right of the last digit in the number. If a customer’s account number was 000234001, this edit word would cause the number to be displayed as 00234-001.

You will notice that when you enter the edit word m-Power right justifies the edit word. This is intentional and required for your edit code to function properly.

Updated on January 26, 2024

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support