Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
569
Report Requirement:

Recently client came with the Report requirement of adding a "." between each digit of a Number value in Database Field. For example, if Database Field Value is: 12345 then client want to show in the report as: 1.2.3.4.5

Interestingly the length of the number can change, sometimes it will be 2 digits and sometimes it will be 6 digits etc.

Solution:

Crystal Report is so much powerful that it can be done by simply creating a Variable with below logic:

Note: In the below logic DATA_PROC.SRL_NBR is a field of a Procedure. You can do the same thing for Field of a Table.

stringVar x := "";
numberVar y := Length(ToText(Trim({DATA_PROC.SRL_NBR})));
numberVar start_pos := 1;
x := Mid (ToText(Trim({DATA_PROC.SRL_NBR})), start_pos,1 );

if (y > 1) then
(
do

(

start_pos := start_pos + 1;

x := x + "." + Mid (ToText(Trim({DATA_PROC.SRL_NBR})), start_pos,1 );

) while (start_pos < (y-1));

);

x
2 Comments
Labels in this area