cancel
Showing results for 
Search instead for 
Did you mean: 

user defined function to get the value before decimal '.'

Former Member
0 Kudos

Hi Guys

for example if my source has values 10000.000 and i must pass to target the values before decimal i.e '10000'

is there any UDF to do the above requirement.

Srinivas

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks for your help.

sunilchandra007
Active Contributor
0 Kudos

>

> for example if my source has values 10000.000 and i must pass to target the values before decimal i.e '10000'

> is there any UDF to do the above requirement.

Hi,

Try this one !!!

public String beforeDecimal(String a, Container container)

{

String arr[] = a.split(",");

return arr[0];

}

Regards,

Chandra

Former Member
0 Kudos

Hi,

You Can use format number and Place #### in properties.....

If this does not work out ....Modify this UDF ....(This UDF gives values after Decimal point):

In Arguments Tab Mention a Function name(label) and Use strcali as first Argument with cache = value

if(strcali.indexOf(".") != -1){

String subStr = strcali.substring(0,strcali.indexOf("."));

strcali = strcali.substring(strcali.indexOf("."));

if(Integer.parseInt(subStr) > 0){

strcali = Integer.parseInt(subStr) + strcali;

}

}

if(strcali.length() > 10) {

strcali = strcali.substring(0,10);

}

return strcali;

Hope this might be of some use

Former Member
0 Kudos

Hi,

U can do this without using a UDF. Try FORMAT NUMBER function under arithmetic. It should help.

Regards,

Anurag

Former Member
0 Kudos

Check the below thread.here he is getting values before comma(,).You can also use the same logic,just replace comma(,) with decimal(.)

Thanks

Aamir