on 01-18-2011 4:17 PM
Hi,
We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
I have done "multiply" with 100 and "formatNumber" as '000000'
SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
Regards,
N@v!n
Hi N@v!n / Gupta,
Both of your solutions works fine.
It may fail if input is '12.347', then output will be '001235'. Note: '001234.7' is rounded '001235'.
If youu2019re sure that you will not get more than 2 digits after decimal, your solution will always work.
Regards,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use these 2 standard functions in this order:
1) ReplaceWith :: replace dot(.) with empty string
2) formatNum (000000)
I hope you dont get input value as 12.00
In that case you can create a UDF.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi,
>
> We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
> I have done "multiply" with 100 and "formatNumber" as '000000'
>
> SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
>
> It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
>
> Regards,
> N@v!n
public void convert_number(String[] FieldValue,ResultList result,Container container){
FieldValue = FieldValue * 100;
result.addValue(FieldValue);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.