Getting a carriage return of report field in SAP Crystal Report



You can make use of split as below −

// To split the text on carriage

Local Stringvar Array lines: = Split( {table.field}, Chr(20) );

// To return carriage 1 less than the number of lines

Local Numbervar delimiters := Ubound(lines)-1;

Let us see one more example, how to use split to divide a string in different lines.

stringvar array x := split({table.fullname}," ");
x[1]
stringvar array x := split({table.fullname}," ");
if ubound(x) >= 2 then
x[2]
stringvar array x := split({table.fullname}," ");
if ubound(x) >= 3 then
x[3]

This will split a string in 3 different lines like

“Mr”

“John”

“Harper”


Advertisements