Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numbering in Crystal Reports

Status
Not open for further replies.

krshtej

MIS
Jan 3, 2011
22
US
Hi,

I have a text field which is a paragraph of notes. I want to display it as point.

ex:
abcdabcdabcd.efghefhefh.ijklijklijkl.

display:
1. abcdabcdabcd
2. efghefghefgh
3. ijklijklijkl

Thanks.
 
stringvar x := {myfield};
Local numbervar i;
local stringvar array AllPoints := split(x,"<br/>");
local stringvar results :="";
for i := 1 to count(AllPoints) do (
Results := Results &
ToText(i,0,"") + ". " + AllPoints+chr(13)
);
Results

data:
Avai on a mo.<br />Incls Lel tions as ayed at Dn Sio.<br /><br />This option le at gn So only.<br />Must be ped for each ly and all va cabt mach.

Thanks,
Krishna.
 
in your data there is a space i didnt see before and didnt account for ... also... there is an additional <br /> which i didnt know was there and didnt account for so use this code with two changes ...
1 - I replaced <br /><br /> with <br /> so that the split function would not add a blank number (unless thats what you wanted)
2 - added a space in <br />.. i had it as <br/>

stringvar x := replace({myfield},"<br /><br />","<br />");
Local numbervar i;
local stringvar array AllPoints := split(x,"<br />");
local stringvar results :="";
for i := 1 to count(AllPoints) do (
Results := Results &
ToText(i,0,"") + ". " + AllPoints+chr(13)
);
Results



please copy that exatly with no changes and let me know if you get the desired results

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Now it is coming something weird. For some only "1." and for some 1,2,1,2,1,2...

Thanks for all the help CoSringsGuy, seems this is something i need to talk to db people and ask them to validate the data. Even I was spending too much time to figure out this, but doesn't seems logic problem.

Thanks,
Krishna.
 
odd

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Why are you using <br/>? What results do you get with the following? It works for me.

stringvar x := {yourfield};
Local numbervar i;
local stringvar array AllPoints := split(x,".");
local stringvar results :="";
for i := 1 to count(AllPoints) do (
Results := Results &
ToText(i,0,"") + ". " + AllPoints+chr(13)
);
if right(x,1)='.' then
left(Results, len(results)-len(totext(i,0,"")+'.')-2) else
Results;

-LB
 
Hi all,

I used the 'Record Number' special field and my issue is solved.
Thanks for all the help. I learnt some new things with the codes you all provided.

Thanks,
Tej.
 
so I can learn something .... what do you mean by "I used the 'Record Number' special field and my issue is solved."?

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Hi CoSpringsGuy,

you know there will be crystal built in special fields like date time, page number etc. similarly there is one called 'record number'.
i created a formula in basic syntax (not crystal syntax) in the formula editor as:

formula = totext(recordnumber,0) & ". " & Replace(Replace(Replace({myfield}, "<br/>", chr(13)), "< br/>", chr(13)))

Thanks,
Tej.
 
I'm not sure I understand how that could possibly be doing what I thought you were originally trying to do but I'm glad you got it figured out...

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Yes, I think that would just add a number at the beginning like this (for a field like "abcdabcdabcd.efghefhefh.ijklijklijkl."):

1. abcdabcdabcd
efghefghefgh
ijklijklijkl

I don't see how it would add a new number for each period.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top