on 11-27-2015 5:14 AM
HI Experts,
I have requirement that need to divide the value with 1000 when ever the field value has five numeric digits. The value will be like
1. 12.123415
2. 123.12312322
3. 1.2312
4. 12345.5678922
But the logic of divide with 1000 has to applicable at case: 4 only.
Please help me here.
Regards,
uday
Hi Uday,
You can achieve this with small user defined function using BigDecimal:
If you know scaling factor of expected decimal values, you can adopt code accordingly to reflect it, otherwise keep it generic.
Please ensure you add import of class java.math.BigDecimal in imports section of your UDF, by default package java.math is not imported in UDFs.
Regards,
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.