Wednesday, June 16, 2010

How to display arabic numbers in crystal reports

Introduction:
I was working on Arabic Project. And there is an issue to show the Arabic Number display in Crystal Report. I face this issue and i couldn't find a solution for display Arabic numbers in crystal reports so I create a Formula and use Replace function.

Background:
It may be useful for Arabic Number Display on your windows forms / Web forms.

Using the code:
stringVar StrArb := ToText({ROTT.Aux_f_3});

StrArb :=
Replace (StrArb ,"0" , "٠" );
StrArb :=
Replace (StrArb ,"1" ,"١" );
StrArb :=
Replace (StrArb ,"2" ,"٢" );
StrArb :=
Replace (StrArb ,"3" ,"٣" );
StrArb :=
Replace (StrArb ,"4" ,"٤" );
StrArb :=
Replace (StrArb ,"5" ,"٥" );
StrArb :=
Replace (StrArb ,"6" ,"٦" );
StrArb :=
Replace (StrArb ,"7" ,"٧" );
StrArb :=
Replace (StrArb ,"8" ,"٨" );
StrArb :=
Replace (StrArb ,"9" ,"٩" );

This is the easy way to convert Numbers into Arabic Number Display..
:D
Its very easy and useful :)

STEP 1:
CLICK ON FORMULA WORKSHOP ( CREATE FORMULA)






STEP 2:

Enter the Formula Name:

STEP 3:
WRITE THE FORMULA CODE FOR DISPLAY ARABIC NUMBER IN CRYSTAL REPORT
stringVar
StrArb := ToText({ROTT.Aux_f_3});
StrArb :=
Replace (StrArb ,"0" , "٠" );
StrArb :=
Replace (StrArb ,"1" ,"١" ); StrArb := Replace (StrArb ,"2" ,"٢" );
StrArb :=
Replace (StrArb ,"3" ,"٣" );
StrArb :=
Replace (StrArb ,"4" ,"٤" );
StrArb :=
Replace (StrArb ,"5" ,"٥" );
StrArb :=
Replace (StrArb ,"6" ,"٦" );
StrArb :=
Replace (StrArb ,"7" ,"٧" );
StrArb :=
Replace (StrArb ,"8" ,"٨" );
StrArb :=
Replace (StrArb ,"9" ,"٩" ); 1) Save Formula and close the formula workshop window
2) click on Field explorer
3) In
Field explorer drag drop your formula on your report

56 comments:

  1. hi asma
    thanks for your efforts to find a solution for this problem.
    please if you can update the images cause its appeared broken
    and what about "ROTT.Aux_f_3"
    variable ?? can you discuss in details plz :)
    thx

    ReplyDelete
  2. "ROTT.Aux_f_3" This is column name from my table. in which some numerical values stored . So I just pass my call and convert into Arabic Numbers.

    ReplyDelete
  3. Hi thx for your answer :)
    If we had a a several colunms
    e.g more than 5 numerical columns
    what we can doing in this case

    Is your formula on the level of whole report or in field level ?

    ReplyDelete
  4. Its for one formula filed . if you have more then 5 filed convert to Arabic then you have to create 5 formula and put on your Crystal Report.
    Thanks

    ReplyDelete
  5. Thanks Asma

    Your efforts are appreciated.

    Jarir

    ReplyDelete
  6. Really good post!

    ReplyDelete
  7. does crystal support arabic ?

    I called them and they said they didnt.

    We have an application developed and want to allow any arabic customers to use crystal. we have since started building in jasper and its working well but prefer crystal's interface

    bobr

    ReplyDelete
  8. how can we convert 100000 in arabic....!!!!

    ReplyDelete
  9. for 100000 in arabic use the same formula

    ReplyDelete
  10. Thanks.. I was looking for this

    ReplyDelete
  11. Is there any localization in UFL to the function ToWords

    ReplyDelete
  12. No localization in UFL to the function ToWords

    ReplyDelete
  13. Thanks Asma, this really helped me, you should be a role model to girls in our country :)

    ReplyDelete
  14. Hi Asma,
    when i paste the Code in the forumla of the Crystal Reports 8.5 the arabic numbers appears same as the English Ones. i search in the regional settings but it turns all numbers to arabic not like the same example u gave.
    Any Solution.....
    Thanks

    ReplyDelete
  15. Hi,
    No need to do anything with regional settings, you need to create forumla in Crystal Report and same you have drage and use in your Report. The forumla will convert English numbers to Arabic numbers.

    Thanks,

    ReplyDelete
  16. When i paste the code in the formula the arabic numbers appears as the following:
    StrArb := Replace (StrArb ,"0" , "0" );
    StrArb := Replace (StrArb ,"1" ,"1" );
    StrArb := Replace (StrArb ,"2" ,"2" );
    StrArb := Replace (StrArb ,"3" ,"3" );
    StrArb := Replace (StrArb ,"4" ,"4" );
    StrArb := Replace (StrArb ,"5" ,"5" );
    StrArb := Replace (StrArb ,"6" ,"6" );
    StrArb := Replace (StrArb ,"7" ,"7" );
    StrArb := Replace (StrArb ,"8" ,"8" );
    StrArb := Replace (StrArb ,"9" ,"9" );

    Thats my problem
    Thanks In Advance

    ReplyDelete
  17. Ooh!!
    no this formula itself showing wrong.
    Cannt you past my code, see the below try to copy past.

    stringVar StrArb := ToText({ROTT.Aux_f_3});
    StrArb := Replace (StrArb ,"0" , "٠" );
    StrArb := Replace (StrArb ,"1" ,"١" );
    StrArb := Replace (StrArb ,"2" ,"٢" );
    StrArb := Replace (StrArb ,"3" ,"٣" );
    StrArb := Replace (StrArb ,"4" ,"٤" );
    StrArb := Replace (StrArb ,"5" ,"٥" );
    StrArb := Replace (StrArb ,"6" ,"٦" );
    StrArb := Replace (StrArb ,"7" ,"٧" );
    StrArb := Replace (StrArb ,"8" ,"٨" );
    StrArb := Replace (StrArb ,"9" ,"٩" );

    the English numbers Replace with Arabic.
    and if you couldn't type/writ Arabic number. Try to Google translate.

    Thanks.

    ReplyDelete
  18. Hello Asma,
    I Need a Function that converts numbers to letters
    but in French language for wording of invoice.
    If you can help me
    thanks In Advance. :)

    ReplyDelete
  19. Hi,

    I want to convert Arbic numbers to translate to Arabic Words...
    Example in english 20 to Twenty.. same thing in Arabic

    ReplyDelete
  20. Hi,
    You can have a look on my other article convert Arbic numbers to translate to Arabic Words as you required. check on below link you can download the Project and test it.

    http://asmaqureshi.blogspot.ae/2013/05/how-to-convert-numbers-to-arabic-word.html

    ReplyDelete
  21. Thanks for any other informative web site. The place else may just I am getting that
    kind of info written in such a perfect method?

    I've a project that I am simply now operating on, and I have been on the glance out for such info.

    Here is my site how to scrape data

    ReplyDelete
  22. Hi,
    I get report data from stored procedure not from table , how could i write filed name?

    thanks

    ReplyDelete
  23. Hi,

    This will be the way stored procedure or from table , just give the name what you have in SP or Table.

    Thanks for comments

    ReplyDelete
  24. Hello...

    The formula work but with long number like the year 2014 it's display ٢,٠١٤.٠٠ how can I fixed??

    ReplyDelete
  25. Hi Asma,

    I want to convert some english characters to arabic in crystal reports, Solution will be appreciable

    ReplyDelete
  26. Hi,

    If you have some specific English characters convert into Arabic, You can create a function in your Crystal Report and use Replace (StrArb ,"1" ,"١" ); function and give your Eng character and required arabic character .

    Thanks

    ReplyDelete
  27. stringVar StrArb := ToText({ROTT.Aux_f_3});

    StrArb := Replace (StrArb ,"0" , "?" );
    StrArb := Replace (StrArb ,"1" ,"?" );
    StrArb := Replace (StrArb ,"2" ,"?" );
    StrArb := Replace (StrArb ,"3" ,"?" );
    StrArb := Replace (StrArb ,"4" ,"?" );
    StrArb := Replace (StrArb ,"5" ,"?" );
    StrArb := Replace (StrArb ,"6" ,"?" );
    StrArb := Replace (StrArb ,"7" ,"?" );
    StrArb := Replace (StrArb ,"8" ,"?" );
    StrArb := Replace (StrArb ,"9" ,"?" );

    ReplyDelete
  28. Hi,
    I would like to inform you that English numbers are the Arabic/Islamic. For your information

    ReplyDelete
  29. Salam,
    I like your effort and Good idea it is working.... but I am trying to use the arabic convert formula in my running totals.... issue is i cannot sum it if adding a formula in running totals... any idea ?

    ReplyDelete
    Replies
    1. I can give you logic. you can put one hiden filed and try to sum and this Sum value you can use the Arabic number conversion

      >> Step one
      do sum your values
      >> Step two
      try to put formula in your Total

      Delete
  30. Thanks for the article... I was able to use the running total as well in your given formula and it solved my problem...
    Thank you

    ReplyDelete
  31. thank for your effort but I am trying to use the arabic convert formula in my report which has about 74 value to be arabic what can i do ?

    ReplyDelete
  32. thanks for help ........my report has 72 column i want to display these at Arabic what can i do ?repeat your formula 72 times
    thanks a lot

    ReplyDelete
  33. Yes this is the solution, I also have more then 39 columns.

    ReplyDelete
  34. dear asma when i paste your code in formula editor arabic 0 is converting to english 0 , i copied from google translate also , still i cannot write arabic 0 in formula editor it is automatically changing to 0

    below is example
    StrArb := Replace (StrArb ,"0" , "0" );

    can u help

    ReplyDelete
  35. The formula work but with long number like the year 81 it's display ٨١.٠٠ and 0 its display ٠.٠٠ how can I fixed??

    ReplyDelete
  36. 81 display ٨١.٠٠ (its correct)
    0 display ٠.٠٠ ( here you can use if else condition , if 0 then display only '٠' )

    ReplyDelete
    Replies
    1. I need output 81 display like ٨١ and 0 like ٠ no need of extra values

      Delete
    2. You need to make exact number , the number you want to showing in Arabic. In your real number their will be 81.00.
      make sure your number without .00 so Arabic number will not show ' .٠٠ '

      Delete
    3. Hi when I am pasting Arabic characters in formula it is coming as ?

      Delete
  37. Hi Asma h r u?
    can u plz check below problem

    stringVar StrArb := ToText({ROTT.Aux_f_3});

    StrArb := Replace (StrArb ,"0" , "?" );
    StrArb := Replace (StrArb ,"1" ,"?" );
    StrArb := Replace (StrArb ,"2" ,"?" );
    StrArb := Replace (StrArb ,"3" ,"?" );
    StrArb := Replace (StrArb ,"4" ,"?" );
    StrArb := Replace (StrArb ,"5" ,"?" );
    StrArb := Replace (StrArb ,"6" ,"?" );
    StrArb := Replace (StrArb ,"7" ,"?" );
    StrArb := Replace (StrArb ,"8" ,"?" );
    StrArb := Replace (StrArb ,"9" ,"?" );

    ReplyDelete
  38. Hi Asma
    Can u plz check below formula
    stringVar StrArb := ToText({ROTT.Aux_f_3});

    StrArb := Replace (StrArb ,"0" , "?" );
    StrArb := Replace (StrArb ,"1" ,"?" );
    StrArb := Replace (StrArb ,"2" ,"?" );
    StrArb := Replace (StrArb ,"3" ,"?" );
    StrArb := Replace (StrArb ,"4" ,"?" );
    StrArb := Replace (StrArb ,"5" ,"?" );
    StrArb := Replace (StrArb ,"6" ,"?" );
    StrArb := Replace (StrArb ,"7" ,"?" );
    StrArb := Replace (StrArb ,"8" ,"?" );
    StrArb := Replace (StrArb ,"9" ,"?" );

    Thanks

    ReplyDelete
  39. Hi Asma H r u..?
    Can u plz check the below formula why ? come.
    stringVar StrArb := ToText({ROTT.Aux_f_3});

    StrArb := Replace (StrArb ,"0" , "?" );
    StrArb := Replace (StrArb ,"1" ,"?" );
    StrArb := Replace (StrArb ,"2" ,"?" );
    StrArb := Replace (StrArb ,"3" ,"?" );
    StrArb := Replace (StrArb ,"4" ,"?" );
    StrArb := Replace (StrArb ,"5" ,"?" );
    StrArb := Replace (StrArb ,"6" ,"?" );
    StrArb := Replace (StrArb ,"7" ,"?" );
    StrArb := Replace (StrArb ,"8" ,"?" );
    StrArb := Replace (StrArb ,"9" ,"?" );

    Thanks

    ReplyDelete
  40. Hi when I try to paste this formulae in Crystal report the Arabic letter is coming as ? what to do?

    ReplyDelete
  41. Hi Asma,
    I want an amount to be converted to arabic in words in crystal reports. Can u Pls help me?

    ReplyDelete
    Replies
    1. You can use the same class I created for Arabic numbers.

      Delete
  42. It is working fine but it is printing in English style like 1.00(١.٠٠) not (٠٠.١)

    ReplyDelete
  43. In Crystal Report! How about amount in word i.e. arabic???

    ReplyDelete
  44. Hi Asma,

    I need to convery my Invoice quantity from English to Arabic. I was useing below formula. But it was showing same Emglish Number only.


    stringVar StrArb := ToText({INV1.Quantity});

    StrArb := Replace (StrArb ,"0" , "٠" );
    StrArb := Replace (StrArb ,"1" ,"١" );
    StrArb := Replace (StrArb ,"2" ,"٢" );
    StrArb := Replace (StrArb ,"3" ,"٣" );
    StrArb := Replace (StrArb ,"4" ,"٤" );
    StrArb := Replace (StrArb ,"5" ,"٥" );
    StrArb := Replace (StrArb ,"6" ,"٦" );
    StrArb := Replace (StrArb ,"7" ,"٧" );
    StrArb := Replace (StrArb ,"8" ,"٨" );
    StrArb := Replace (StrArb ,"9" ,"٩" );

    ReplyDelete
  45. Hi
    1) You have to use the formula which you created and
    2) click on Field explorer
    3) In Field explorer drag drop your formula on your report
    Then it will be in Arabic numbers.

    ReplyDelete
  46. Hi Asma,
    Thanks for the solution it's very useful, But when use the formula the numbers are being printed as ٢,٠٠

    ReplyDelete
  47. i want to convert english date to hijri date in crystal reports...

    ReplyDelete