Crystal report issue with int to string conversion

℡╲_俬逩灬. 提交于 2019-12-07 06:47:46

问题


I want to convert int to string and then concatenate dot with it. Here is the formula

totext({#SrNo})+ "."

It works perfectly but not what i want. I want to show at as

1.

but it shows me in this way

1.00.

it means that when i try to convert int to string it convert it into number with precision of two decimal zeros. Can someone tell me how can i show it in proper format. For information i want to tell you that SrNo is running total.


回答1:


ToText(x, y, z, w) Function can use

x=The number to convert to text

y=The number of decimal places to include in result (optional). The value will be rounded to that decimal place.

z=The character to use as the thousands separator. If you don’t specify one, it will use your application default. (Optional.)

w=The character to use as the decimal separator. If you don’t specify one, it will use your application default. (Optional.)

Examples

ToText(12345.678) = > “12345.678″

ToText(12345.678,2) = > “12345.67″

ToText(12345.678,0) = > “12345″




回答2:


You can try this :

totext({fieldname},0)



回答3:


Ohhh I got the answer it was so simple. totext takes 4 parameters

First parameter is value which is going to be converted
Second parameter is number of decimal previsions.
Third parameter is decimal separator. like (1,432.123) here dot(.) is third parameter.
Forth parameter is thousand separator. like (1,432) here comma(,) is forth parameter.

Example{
        totext("1,432.1234",2) results 1,432.12
        totext("1,432.1234",2,' " ') results 1,432"1234
        totext("1,432.1234",2,' " ', ' : ') results 1:432,1234
       }

Although i think this example may be not so good but i just want to give you an idea. This is for int conversion for date it has 2 parameters. value to be converted and format of date.



来源:https://stackoverflow.com/questions/14169227/crystal-report-issue-with-int-to-string-conversion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!