Skip to Content
0
Dec 21, 2021 at 10:24 AM

In Multiple Rows Superscript/Subscript printing in SAP Crystal Report

103 Views Last edit Dec 22, 2021 at 03:16 PM 2 rev

hai,

how to print superscript/subscript in multiple rows in crystal report from Oracle database.

in database am saving the record as

sr.no value

1 4.0 X 10<sup>2</sup>

2 6.8 X 10<sup>2</sup>

Now need to print these two rows into crystal report.

i got the code from forum itself and its working fine.but its only for one value at a time. if multiple rows to be printed its not functioning. always printing first row value.

from the below code 'x' is taking always first value. so in report all lines (detail section) appearing first row value.

NOTE: FROM THE SAP FORUM I GOT THE BELOW CODE

// set this to your field

stringvar x:="";

x:= {TMPMASREPNEW.FL82};//'MY TABLE FIELD

// set these next four values to the separators used in your code

stringvar subS:= '<sub>'; // beginning of a subscript

stringvar subE:= '</sub>'; // end of a subscript

stringvar supS:= '<sup>'; // beginning of a superscript

stringvar supE:= '</sup>'; // end of a superscript

// the syntax below does not need to be changed

// this part deals with subscript

stringvar array sa:= split(x, subS);

while numbervar i < ubound(sa) do

(

i:= i + 1;

stringvar t:= sa[i];

if instr(t, subE) > 0 then

(

stringvar t1:= split(t,subE)[1];

t1:= replace(t1, '0', '₀'); // 0

t1:= replace(t1, '1', '₁'); // 1

t1:= replace(t1, '2', '₂'); // 2

t1:= replace(t1, '3', '₃'); // 3

t1:= replace(t1, '4', '₄'); // 4

t1:= replace(t1, '5', '₅'); // 5

t1:= replace(t1, '6', '₆'); // 6

t1:= replace(t1, '7', '₇'); // 7

t1:= replace(t1, '8', '₈'); // 8

t1:= replace(t1, '9', '₉'); // 9

t1:= replace(t1, '+', '₊'); // +

t1:= replace(t1, '-', '₋'); // -

t1:= replace(t1, '=', '₌'); // =

t1:= replace(t1, '(', '₍'); // left parenthesis

t1:= replace(t1, ')', '₎'); // right parenthesis

t:= t1 + split(t,subE)[2];

);

stringvar output:= output + t

);

// this part deals with superscript

x:= output;

i:= 0;

output:= '';

stringvar array sa:= split(x, supS);

while numbervar i < ubound(sa) do

(

i:= i + 1;

stringvar t:= sa[i];

if instr(t, supE) > 0 then

(

stringvar t1:= split(t,supE)[1];

t1:= replace(t1, '0', '⁰');

t1:= replace(t1, '1', '¹');

t1:= replace(t1, '2', '²');

t1:= replace(t1, '3', '³');

t1:= replace(t1, '4', '⁴');

t1:= replace(t1, '5', '⁵');

t1:= replace(t1, '6', '⁶');

t1:= replace(t1, '7', '⁷');

t1:= replace(t1, '8', '⁸');

t1:= replace(t1, '9', '⁹');

t1:= replace(t1, '+', '⁺');

t:= t1 + split(t,supE)[2];

);

stringvar output:= output + t

);

output

***********code ended

Please help in this regards.

thanks in advance

Sajeesh