14 Replies Latest reply on Aug 12, 2015 12:12 AM by HuaD

# How to transfer digits to the capital form of a Chinese numeral?

### Title

How to transfer digits to the capital form of a Chinese numeral?

### Post

Hi,

I've been struggled to find ways to make FM pro 12 show the right Capital form in Chinese, I need you help to let FM pro show  the RIGHT capital form of a Chinese numeral. ( Filemaker pro 12 does support Japanese Kanji, but that is not Chinese Character and the way write in Chinese )

=======INSTRUCTION=============

In china, every 4 digits are a unit, such as ten hundred, ten thousand  ( in english, every 3 digits are a unit such as a hundred, a thousand ), here are rules,

Basic unit of the capital form of a Chinese numeral

•           "0" zero called "LING" "0"
•
•           "10" ten called "SHI" "10"
•
•           "100" a hundred called "BAI","100"
•
•           "1,000" a thousand called "QIAN", "1000"
•
•           "10,000" ten thousand called " WAN ", "1,0000"
•
•           "100,000,000"a hundred million called "YI" "1,0000,0000"

examples,

•           123 in Chinese called "1 BAI 2 SHI 3"
•
•           1023 in Chinese called "1 QIAN 0 2 SHI 3"
•
•           12300 in Chinese called "1 WAN 2 QIAN 3 BAI "
•
•           10,2300 in Chinese called "1 SHI WAN 2 QIAN 3 BAI"
•
•           10,0023 in Chinese called "1 SHI WAN 0 2 SHI 3"
•
•           10,0203 in Chinese called "1 SHI WAN LING 2 BAI 0 3"

If there is a 0 or more between two digits ( digit not 0), 0 should be pronounced only once.

FOR Chinese currency unit and Chinese Capital is very similar, but there are "YUAN" "JIAO" "FEN" in the middle, 1 YUAN = 10 JIAO = 100 FEN, YUAN is the basic Unit, like Dollar and Yen.

•           ¥1.23, called 1 YUAN 2 JIAO 3 FEN
•
•           ¥10,0020.33, called 1 QIAN 0 2 SHI YUAN 3 JIAO ZHENG

•                ¥123.00, called 1 BAI 2 SHI 3 YUAN ZHENG
•
•                ¥120.03, called 1 BAI 2 SHI YUAN 0 3 FEN
•

If there is a digit ( not 0 ) in FEN, then the write form is end with FEN,

If there is 0 in FEN, then the write form is end with ZHENG

Online tool that transfer digits to Chinese numeral form   http://app.baidu.com/app/enter?appid=122347

=======INSTRUCTION END=============

Thank you for reading, I really hope this could be done here, or you could just give me some instructions or script that I could edit it.

Hope Filemaker 13 would fix this issue.

• ###### 1. Re: How to transfer digits to the capital form of a Chinese numeral?

1023 壱阡弐拾参
12300 壱萬弐阡参陌

are good for you ? If not, how do you want the result ?

• ###### 2. Re: How to transfer digits to the capital form of a Chinese numeral?

Thank you, but that's Japanese Kanji (not only the charactor is different, but also ruls to write), in Chinese should be like thiese，

1023  壹仟贰拾叁

12300  壹万贰仟叁佰

123.123 壹佰贰拾叁点壹贰叁  （“.” in Chinese is "点" ）

in Chinese currency, should be like these

￥1023  壹仟贰拾叁元整

￥12300  壹万贰仟叁佰元整

￥12.3  壹拾贰元叁角整

￥1.23  壹元贰角叁分

• ###### 3. Re: How to transfer digits to the capital form of a Chinese numeral?

How great could be the Chinese numeral ?

Could we suppose that it can't be more than 999,999.99 ?

• ###### 4. Re: How to transfer digits to the capital form of a Chinese numeral?

Usually the Chinese numeral is used to describe the currency ( or some other important numbers such as contracts' item etc.), and I suggest  the greater the better.

Normally, we use numbers less than 999,999,999.99 ( that is most popular accountant note's limitation )

• ###### 5. Re: How to transfer digits to the capital form of a Chinese numeral?

I have yet to complete it but  try this Custom Function.

/*
NumToChText ( number ) Custom Function

Daniele Raybaudi

v. 0.1 ( only positive numbers; lacks the special case: 11 ; missing decimals )
*/

Let([
i = Int ( Abs ( number ) ) ;
d = Mod ( Abs ( number ) ; 1 ) ;
f = Floor ( Log ( i ) ) ;
n = Mod ( number ; 10 ^ f ) ;
c1 = Choose ( Left ( i ; 1 ) ; "" ; "壹" ; "贰" ; "叁" ; "肆" ; "伍" ; "陆" ; "柒" ; "捌" ; "玖" ) ;
c2 = Choose ( f  ; "" ; "拾" ; "佰" ; "仟" ; "萬" ; "拾萬" ; "佰萬" ; "仟萬" ; "億" ; "拾億" ; "佰億" ; "仟億"  ) ;
c3 = If ( Floor ( Log ( n ) ) < f - 1 ; "零" )
];
Case(
Length ( i ) > 12 ; "number too large" ;
i ; c1 & c2 & c3 & NumToChText ( n )
)
)

• ###### 6. Re: How to transfer digits to the capital form of a Chinese numeral?
A little question: which one is correct ? ( or they are both correct? )
1012 壹仟零壹拾贰
1012 壹仟零拾贰

BTW: this handles more digits and decimals:

/*
NumToCText ( number ) Custom Function

Author: Daniele Raybaudi

v. 0.2 ( new function name ; handles positive numbers till 9,999,999,999,999,999.99 )
v. 0.1 ( only positive numbers; lacks the special case: 11 ; missing decimals )
*/

Let([
x = 0 < number and number < 10^16 ;
i = If ( x ; Int ( Abs ( number ) ) ) ;
d = If ( x ; Mod ( Abs ( number ) ; 1 ) ) ;
f = Floor ( SetPrecision ( Log ( i  ) ; 17 ) ) ;
m = Mod ( number ; 10 ^ f ) ;
c1 = Choose ( Left ( i ; 1 ) ; "" ; "壹" ; "贰" ; "叁" ; "肆" ; "伍" ; "陆" ; "柒" ; "捌" ; "玖" ) ;
c2 = Choose ( f  ; "" ; "拾" ; "佰" ; "仟" ; "萬" ; "拾萬" ; "佰萬" ; "仟萬" ; "億" ; "拾億" ; "佰億" ; "仟億" ; "兆" ; "拾兆" ; "佰兆" ; "仟兆" ) ;
c3 = If ( Floor ( Log ( Mod ( i ; 10 ^ f ) ) ) < f - 1 ; "零" )
];
Case(
i ; c1 & c2 & c3 & NumToCText ( m ) ;
d ; Substitute ( d
; [ Left ( d ; 1 ) ; "點" ]
; [ 0 ; "零" ]
; [ 1 ; "壹" ]
; [ 2 ; "贰" ]
; [ 3 ; "叁" ]
; [ 4 ; "肆" ]
; [ 5 ; "伍" ]
; [ 6 ; "陆" ]
; [ 7 ; "柒" ]
; [ 8 ; "捌" ]
; [ 9 ; "玖" ]
)
)
)

• ###### 7. Re: How to transfer digits to the capital form of a Chinese numeral?

"1012 壹仟零壹拾贰" is correct (the second is wrong in Chinese).

that is very helpful, but when I try to add this function ts o custom function (or try to paste it in calculation field), it pops out a message said "This function can not be found" which is "NumToCText", how can I add this function to my function list?

• ###### 8. Re: How to transfer digits to the capital form of a Chinese numeral?

Do you have FMP Advanced ?

• ###### 9. Re: How to transfer digits to the capital form of a Chinese numeral?

Yes, I have FileMaker Pro  advance 12. I also tried to flowed the user guide to add a customer function to FMPA, but it pops a message said "NumToCText" does not exists.

I use FileMaker on OS X 10.9.

• ###### 11. Re: How to transfer digits to the capital form of a Chinese numeral?

NumToCText is the name of Raybaudi's custom function. If you don't name your custom function with this exact name, you will get this error message.

• ###### 12. Re: How to transfer digits to the capital form of a Chinese numeral?

Now try to find an error into  the final ( v. 1 ) version of the CF:

/*
NumToCText ( number ) Custom Function
Author: Daniele Raybaudi

Converts Roman numbers in number to Chinese text.
( with number < 10^16 )

v.1 11/11/2013
*/

Let([
\$cfFirstRun = \$cfFirstRun + 1 ;
x = number < 10^16 ;
i = If ( x ; Int ( Abs ( number ) ) ) ;
d = If ( x ; Mod ( Abs ( number ) ; 1 ) ) ;
f = Floor ( SetPrecision ( Log ( i  ) ; 17 ) ) ;
m = Mod ( Abs ( number ) ; 10 ^ f ) ;
s = If ( \$cfFirstRun = 1 and Left ( number ; 1 ) = "-" ; "負" ) ;
c0 = "拾" & Choose ( Mod ( i ; 10 ) ;  "" ; "壹" ; "贰" ; "叁" ; "肆" ; "伍" ; "陆" ; "柒" ; "捌" ; "玖" ) ;
c1 = Choose ( Left ( i ; 1 ) ; "" ; "壹" ; "贰" ; "叁" ; "肆" ; "伍" ; "陆" ; "柒" ; "捌" ; "玖" ) ;
c2 = Choose ( f  ; "" ; "拾" ; "佰" ; "仟" ; "萬" ; "拾萬" ; "佰萬" ; "仟萬" ; "億" ; "拾億" ; "佰億" ; "仟億" ; "兆" ; "拾兆" ; "佰兆" ; "仟兆" ) ;
c3 = If ( Floor ( Log ( Mod ( i ; 10 ^ f ) ) ) < f - 1 ; "零" )
];
s &
Case(
\$cfFirstRun = 1 and 10 < i and i < 20 ; c0 & NumToCText ( d ) ;
i ; c1 & c2 & c3 & NumToCText ( m ) ;
d ; Substitute ( d
; [ Left ( d ; 1 ) ; "點" ]
; [ 0 ; "零" ]
; [ 1 ; "壹" ]
; [ 2 ; "贰" ]
; [ 3 ; "叁" ]
; [ 4 ; "肆" ]
; [ 5 ; "伍" ]
; [ 6 ; "陆" ]
; [ 7 ; "柒" ]
; [ 8 ; "捌" ]
; [ 9 ; "玖" ]
)
) & Let ( \$cfFirstRun = "" ; "" )
)
• ###### 13. Re: How to transfer digits to the capital form of a Chinese numeral?

Thank you, function works great.

• ###### 14. Re: How to transfer digits to the capital form of a Chinese numeral?

Hi, raybaudi, found a little issue with your custom function,

for example:

1,111,111 should be  壹佰壹拾壹萬壹仟壹佰壹拾壹

your code returns      壹佰壹拾壹萬壹仟壹佰壹拾壹, the character 萬(underlined), is not needed,

is there a way to fix it for us? thanks a lot