Crystal Reports ToText and ToWards function

ToText Function

An very important built function in in Crystal Reports required in strig formulas. ToText function coverts other datatypes to string data type enabling these to be used in concatenation or comparison. Dates, numbers or any datatypes you need in string used to text.

Towords function

ToWords is a very useful function in writing cheques, invoice where no and words are required.
for example ToWords({Salary.Amount}) where amount is 123.10 it will in appear in Crystal reports as one hundred twenty three dollars and ten cents.

More information on these Crystal Reports formulas can be found on Crystal Reports Online Line Help.

We will write more about Crystal formulas and functions stay tuned.

12 Responses so far.

  1. Razan says:

    i need to know if i can use the to word function to convert numbers to chinese word characters?

  2. mahesh says:

    hi. I am used Crystl report.how to print towords in the value 2,45,545.

  3. mahesh says:

    Hi,
    I need help in crystal reports Check printing. While printing number in words it is printing 3,65,945.00 .
    i want words in ” THREE LACKS SIXTEFIVE THOUSAND AND NINE HUNDARD AND FORTY FIVE ONLY”.
    I WANT FORMULA.
    THANKS

  4. Prageeth says:

    write funtion
    Ex:
    ToWords(Invoice.Value)

  5. mahesh says:

    hi ! i am used vb.net+msAccess.
    i m user crystalreport.
    how to Export to CrystalReport To Tally9.
    if its possiable? pls help me.
    my email id: vmahee@gmail.com.

  6. KSKarthikeyan says:

    Hi,

    You can follow the below example of ToWord Function.

    ProperCase(Replace(ToWords (( {sp_AgFinV2Cheque;1.FINALAMT})),’and xx / 100′,’only’))

  7. Raj Kumar says:

    Hello Sir,

    I am Rajkumar.working in SAP B1.for that i have to work in crystal reports.i am having doubts in crystal reports(Formula fields).
    Please guide me to get knowledge in formula fields.especcially i want to know, how to convert Number into words(Convert into Indian Rupee).

    please do the needful.

    Please Mail me , that if you have any pdf for formula fields.

    Thanks & Regards
    Rajkumar.k

  8. admin says:

    You have to create 2 formula fields as follows
    1- ProperCase (‘Indian Rs’) This field is created in the Crystal formula.

    2- ToWords ({StoredProcedure3_1;1.Salary}) – This field is a Salary field.

    Then you can put these 2 fields in your report. I fyou find another alternative solution please let us know.

  9. Farhan Rana says:

    I need help in crystal reports 8.5 Check printing. While printing number in words it is printing 3,65,945.60 .
    i want words in ” THREE LACKS SIXTEFIVE THOUSAND NINE HUNDARD FORTY FIVE RUPEES AND Sixty Paisa ONLY”.
    I WANT FORMULA.
    Plz Mail me immediately at
    rana_farhanr@hotmail.com

  10. Hoysala says:

    Towords function

    ToWords is resulting in as one hundred twenty three and 10 / 100
    its not showing cents in words

  11. Hoysala says:

    Hello mahesh, Raj Kumar, admin and Farhan Rana.

    Use the below formula it works fine for Indian Ruppees.
    But please tell me how to convert number into US Currency words where last 2 decimal should be framed as cents in words

    numbervar RmVal:=0;
    numbervar Amt:=0;
    numbervar pAmt:=0;
    stringvar InWords :=”Rupees “;
    Amt := tonumber(Sum({@Amount}));
    if Amt > 10000000 then RmVal := truncate(Amt/10000000);
    if Amt = 10000000 then RmVal := 1;
    if RmVal = 1 then
    InWords := InWords + ” ” + towords(RmVal,0) + ” crore”
    else
    if RmVal > 1 then InWords := InWords + ” ” + towords(RmVal,0) + ” crores”;

    Amt := Amt – Rmval * 10000000;
    if Amt > 100000 then RmVal := truncate(Amt/100000);
    if Amt = 100000 then RmVal := 1;
    if RmVal >=1 then
    InWords := InWords + ” ” + towords(RmVal,0) + ” lakhs”;

    Amt := Amt – Rmval * 100000;
    if Amt > 0 then InWords := InWords + ” ” + towords(truncate(Amt),0);
    pAmt := (Amt – truncate(Amt)) * 100;
    if pAmt > 0 then
    InWords := InWords + ” and ” + towords(pAmt,0) + ” paisa only”
    else
    InWords := InWords + ” only”;
    UPPERCASE(InWords)

  12. admin says:

    local stringvar isNumber := cstr({SalesOrderDetail.UnitPrice});
    local numbervar iswhole := ToNumber ({SalesOrderDetail.UnitPrice});
    local numbervar ispos := instrrev(isNumber, ‘.’);
    local numbervar isdecimal := 0;

    if ispos > 0 then
    (
    isdecimal := CDbl(right(isNumber, length(isNumber) – ispos));
    );

    Uppercase(ToWords(iswhole, 0) + ‘ Dollars and ‘ + ToWords(isdecimal, 0) + ‘ Cents Only’);

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>