Hi Lockwelle,
Thansk for your suggestion. I'm afraid the customer may not like Book 1 instead of Book one which is the 'real' title.
I was using the following coversion routine obtained from SAP CR forum, the result of displaying is just as what you have said.
The codes:
local stringvar array toclean ;// text to delete into title
local stringvar array numberlist ;// list number in text in
local stringvar sortvolume;
local numbervar sortnum;
local numberVar counter;
local stringVar booktitle;
local stringVar booktitleb;
numberlist:=["zero","one","two","three","four","five","six"];
toclean:=["Book","volume","episode"];
sortvolume:={HEADING.HEAD};//book title
// find book title and order infos
for counter:=1 to UBound(toclean) step 1 do
(
if lowercase(toclean[counter]) in lowercase(sortvolume) then
(
booktitle:= left(sortvolume,(InStr(lowercase(sortvolume),
lowercase(toclean[counter])))-2);
booktitleb:=mid(sortvolume,InStr(lowercase(sortvolume),
lowercase(toclean[counter])));
exit for
)
);
// delete words from toclean into sortvolume
for counter:=1 to UBound(toclean) step 1 do
booktitleb:= trim(replace(booktitleb,toclean[counter],"",1,-1,1));
if isnumeric(booktitleb)=true then sortnum:=ToNumber (booktitleb);
//look up if words from numberlist is equal to sortvolume if yes allocate number at place
for counter:=1 to UBound(numberlist) step 1 do
(
if numberlist[counter]=booktitleb then
(
sortnum:=counter-1;
exit for
)
);
//create sort field with book title and sortnum
if sortnum<10
then booktitle+" 0"+totext(sortnum)
else
booktitle+" "+totext(sortnum)
The result of display in the report:
Great stories for kids. 01.00
Great stories for kids. 02.00
Great stories for kids. 03.00
but titles with 'Volume' became:
The Bible story. 00.00
The Bible story. 00.00
The Bible story. 00.00
The Bible story. 00.00 etc
The actutal location of Volume X is in the middle of the title:
The Bible story. Volume 1, The book of beginnings
The Bible story. Volume 10, Onward to glory
The Bible story. Volume 2, Mighty men of old
Any advices on that? Thanks a lot!
John
Edited by johnwsun - 13 May 2009 at 3:18am