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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count line

Status
Not open for further replies.

ttechie

Technical User
Feb 11, 2005
56
IN
I am new to crystal reports. I am trying to count lines in crystal rpt. I want to know how to count 65 characters per line, and we count key stroke here also counting headers. Please please help!
 
Hi,
Some details:
What version of CR ?

Why do you need to count those?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I am using CR 10. I have a report that lists a text field in multiple lines. I need this column on the report to only list 65 characters per line, and then I need to somehow count the number of lines printed for each ID. The formula i am using is below But i get text instead of number of lines.
shared numberVar RowsThisRecord;
stringVar Result;
numberVar RowCount := int((len({MEDICAL_REPORT_OBJECT.MRO_TEXT}) / 65)+0.99999);
RowsThisRecord := RowCount;
numberVar i;
for i := 1 to RowCount do
(
Result := Result + mid({MEDICAL_REPORT_OBJECT.MRO_TEXT},(i*65) - 64, 65) + chr(10);
);
Result;
 
Hi,
You get text because you are returning the stringVar ( Result) which is just the chr(10) separated text, not a count of how many times it was used..
Maybe return RowCount instead of Result..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
You formula is returning the text reformatted at 65 lines per (though you might use chr(13) instead, or chr(10)&chr(13).

And why are you usaing a shared variable, are you passing values to/from main/subreports, or?

Try this formula:

shared numberVar RowsThisRecord;
stringVar Result;
numberVar RowCount := int((len({MEDICAL_REPORT_OBJECT.MRO_TEXT}) / 65)+0.99999);
RowsThisRecord := RowCount;
numberVar i;
for i := 1 to RowCount do
(
Result := Result + mid({MEDICAL_REPORT_OBJECT.MRO_TEXT},(i*65) - 64, 65) + chr(10);
);
"Rows this record: " & RowCount & chr(13) & Result;

You can eliminate the RowsThisRecord variable, it isn't doing anything.

-k
 
Now I get an error when i tried below farmula. Any other Suggestions.I am new to this so bear with me.
numberVar RowsThisRecord;
stringVar Result;
numberVar RowCount := int((len({MEDICAL_REPORT_OBJECT.MRO_TEXT}) / 65)+0.99999);
RowsThisRecord := RowCount;
numberVar i;
for i := 1 to RowCount do
(
RowCount := Result + mid({MEDICAL_REPORT_OBJECT.MRO_TEXT},(i*65) - 64, 65) + chr(10);
);
RowCount;
 
synapsevampire, Now it showes the number of line in last text field only. It skiped 13 text fields and counted only the 14th text field which has 7 lines and it is correct! But what about the other 13. Also is there a way to to count the grand total of all text field.
Thanks for the help!
 
Don't say "I get an error", state what the error said.

numberVar RowsThisRecord;
stringVar Result;
numberVar RowCount := int((len({MEDICAL_REPORT_OBJECT.MRO_TEXT}) / 65)+0.99999);
RowsThisRecord := RowCount;
numberVar i;
for i := 1 to RowCount do
(
Result := Result + mid({MEDICAL_REPORT_OBJECT.MRO_TEXT},(i*65) - 64, 65) + chr(10);
);
RowCount

I gave you a solution, which you promptly ignored. As a beginner you might want to wait on th rewrite until you

This formula now returns the rowcount, but not the text. That part of the formula is now pointless.

Please post specifics of what you want and where. My last post returned both, but I guess you didn't want that or whatever it is that made you decide to alter it.

-k

 
synapsevampire, i followed with your solution and honestly didn't ignore it and thanks to you guys it showes how many line in each user text field. Thanks guys!
 
guys, When I click the next page to I get a message "A string can be at most 65534" characters long" Any Ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top