5

The Power of Crystal Reports: Data Manipulation on the Fly

 1 year ago
source link: https://blogs.sap.com/2022/10/16/the-power-of-crystal-reports-data-manipulation-on-the-fly/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
October 16, 2022 Less than a 1 minute read

The Power of Crystal Reports: Data Manipulation on the Fly

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));


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK