Solved

Crystal Reports Numbering a Line Wrapping

Posted on 2015-01-14
7
83 Views
Last Modified: 2015-01-28
I have a field that is set-up as 'Can Grow'.  Is it possible to number the line when it wraps?
Accounting wants something like this:
$1$One Million Seven Hundred Seventy-Seven Thousand Seven Hundred
$2$Seventy-Seven and 77/100
This is a field in a print-out of a check run and a large amount check will not fit on one line.
0
Comment
Question by:slmc
  • 4
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 40550055
How are you generating the text?

mlmcc
0
 

Author Comment

by:slmc
ID: 40550074
uppercase (ToWords ({CASH_DISBURSEMENT.AMOUNT}))
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40575796
What is generated by the report now?

Try this formula

Local StringVar NumberText;
Local StringVar Array arrNumberText;
Local NumberVar Index;
Local NumberVar lengthNumberText;
Local NumberVar LineCount;
Local NumberVar ReportFieldWidth  := 35;

arrNumberText := Split(Uppercase(ToWords((({CASH_DISBURSEMENT.AMOUNT},2)));
NumberText := '$1$';
lengthNumberText := 3;
LineCount := 1;
For Index := 1 to UBound(arrNumberText) do
(
    
    lengthNumberText := lengthNumberText + length(arrNumberText[Index]) + 1;
    If lengthNumberText > ReportFieldWidth then
    (
        LineCount := LineCount + 1;
        NumberText := NumberText & chr(13) & '$' & CStr(LineCount,0) & '$';
        lengthNumberText := 3 + length(arrNumberText[Index]) + 1;
    );    
    NumberText := NumberText & ' ' & arrNumberText[Index];
);

NumberText

Open in new window


Change the 35 in the above code to the number of characters your field is wide minus 2.  You will probably have to test some numbers to get the one that works best.  It is better to be a little low on the count.  The number depends on the font you use and the font size.

In my testing I used a Courier 10 for the font.  Courier is fixed size font so there are 12 characters per inch.  The width was 3".  I first tried 35 for the count and my text wrapped in the middle of line 1.  Changed to 34 and it worked correctly.  I didn't try a lot of numbers in the test so run it against your data just to the screen and see what you get.

mlmcc
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:slmc
ID: 40575915
That gives me exactly what I want.  Thank you very much
0
 

Author Comment

by:slmc
ID: 40576037
I've requested that this question be closed as follows:

Accepted answer: 0 points for slmc's comment #a40575915

for the following reason:

This does exactly what I want.
0
 
LVL 34

Expert Comment

by:James0628
ID: 40576016
You accepted your own post as the solution.  I assume that you meant to accept mlmcc's last post instead.  You can cancel the closing of the question and re-close the question.

 James
0
 

Author Closing Comment

by:slmc
ID: 40576038
Exactly what I needed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now