on 03-16-2009 2:44 PM
Hi All,
I have to sum all of my amount values in Detail Records. I want to use BigDecimal in UDF because if I use the standard sum, the precision is going to be more than 4 digits. So if we use BigDecimal then I will get the exact result. Can anyone please help me for writing the UDF for getting the sum of all my numbers using BigDecimal.
Your inputs are highly appreciated.
Cheers,
korobee
Hi,
Refer this Blog <a href="/people/thorsten.nordholmsbirk/blog/2006/08/25/new-arithmetic-and-statistical-functions-in-message-mappings-in-sp18 Arithmetic and Statistical Functions in Message Mappings in SP18</a>.
Following is the code to add two numbers using BigDecimal.
String add(String a, String b)
{
BigDecimal bigA = new BigDecimal(a);
BigDecimal bigB = new BigDecimal(b);
BigDecimal bigSum = bigA.add(bigB);
return bigSum.toString();
}
Refer: Blog
Thanks,
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is a statistic function called sum. You may need to use format number.Can you please provide a sample input/output?
Hope this helps,
Regards,
Edited by: Mark Dihiansan on Mar 16, 2009 3:46 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.