Friday, June 29, 2007

Formatting char/number to US style phone number

Someone asked this question on Oracle BI publisher forum and i just wondered whether it is possible with any formatting XSL function or not. I tried with format-number function but finally i got with extended XSL functions for use in RTF template

Case:
Let's say we have xml data in below format
1234567890
Now we want to display it as (123)456-7890 (US style Ph #)

Solution:
<?xdofx:’(‘||substr(Phone_No,1,3)||’) ’||substr(Phone_No,4,3)||’-‘||substr(Phone_No,7,4)?>

7 comments:

  1. hello,
    I want to format a number like this format (123 456 254 214,410)
    : space for thoussand separator and ',' for decimal separator using XML Publisher.
    Can u tell me how to do that.
    Thanks.

    ReplyDelete
  2. THANK YOU, THANK YOU, THANK YOU! I've looked everywhere for this format and couldn't find anything helpful!

    ReplyDelete
  3. Thanks a lot for writing this blog.
    It solved my prob:-)

    ReplyDelete
  4. Excellent.. me too looked for many places.. but here only I got luckily..Thanks a lot..

    ReplyDelete
  5. xdofx:substr(NATIONAL_ID,1,3)||’-’||substr(NATIONAL_ID,4,2)||’-‘||substr(NATIONAL_ID,6,4)

    ReplyDelete