Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Printing Cheques through crystal Post Reply Post New Topic
Author Message
Amar.kmf
Newbie
Newbie


Joined: 19 Apr 2012
Online Status: Offline
Posts: 2
Quote Amar.kmf Replybullet Topic: Printing Cheques through crystal
    Posted: 19 Apr 2012 at 1:38am
Hi

Iam trying to create a crystal report for cheque printing and wants to convert amount into word, tried towords option but that just give me one full line.
here the example what i want to achieve.
if the amount is 12310.88
 
100,000 :10,000: 1000: 100:     10:    Units : Pence        preprinted 
Zero        One       Two    three    One   Zero : 88             Result
Is it possible through crystal?
 
Thanks in advance
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Apr 2012 at 3:10am
numbervar x := {table.valuefield};
 
stringvar y:= totext(x,2,"");
stringvar str:= right("000000" & left(y,instr(y,".")-1),6);
stringvar array w:= ["One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Zero"];
numbervar one;
numbervar two;
numbervar thr;
numbervar fou;
numbervar fiv;
numbervar six;
one:= if mid(str,1,1) = "0" then 10 else tonumber(mid(str,1,1));
two:= if mid(str,2,1) = "0" then 10 else tonumber(mid(str,2,1));
thr:= if mid(str,3,1) = "0" then 10 else tonumber(mid(str,3,1));
fou:= if mid(str,4,1) = "0" then 10 else tonumber(mid(str,4,1));
fiv:= if mid(str,5,1) = "0" then 10 else tonumber(mid(str,5,1));
six:= if mid(str,6,1) = "0" then 10 else tonumber(mid(str,6,1));
w[one]
 
Redefine x with your value field and that should give you what you want (Assuming your value field never amounts to more than 999,999.99). You'll need six versions of the formula to display each character in a separate field, ie in your second one you would replace w[one] with w[two].
 
Regards,
Ryan.


Edited by rkrowland - 19 Apr 2012 at 3:18am
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Apr 2012 at 5:50am
Thought of a much better way to do this, completely disregard my last post... I dunno what I was thinking with that....
 
Again you'll need 6 different formulas (1 for each unit), simply specify your number field (x) and the unit you wish to know (unit).
 
numbervar x:= {table.valuefield};
numbervar unit:= 100000;
 
numbervar value:= floor(x,1);
numbervar y:= floor(value/unit,1) - floor(value/unit,10);
towords(y,0)
 
Regards,
Ryan.
IP IP Logged
Amar.kmf
Newbie
Newbie


Joined: 19 Apr 2012
Online Status: Offline
Posts: 2
Quote Amar.kmf Replybullet Posted: 24 Apr 2012 at 4:13am
Hi Ryan,
Formula is spot on, finally finished my report. Thanks for your help
Greatly appreciated.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.