Tuesday 8 December 2015

Format Numbers as text so that the report output displays leading zeros.


Introduction:
Many times when working with reports customers use sequence numbers that often appended with zeros to the start of the number. When we use that in the report, the report output Excel or PDF, usually the Zero's disappears.

Example: 
Data in the table: 000000220513
Report output    : 220513


Steps:
To display the report output as 220513, the following options can be used.

1. Changes in RTF layout template.

Open the the BI Publisher properties for the field and check Force LTR option.

When you check this option you can see the following code in the Advanced tab or Form field help text field you can see following:

<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><?DOC_SEQ_NUM?></fo:bidi-override>

Alternatley you can write the above code for the field.


2. Change the SQL to output the column with quotes so that the character format preserves.

select '="' ||DOC_SEQ_NUM || '"'  from dual;

1 comment: