on 01-07-2009 2:34 PM
The requirement is like i want to take 5 digits after decimal point. But I have to do this as part of udf.
Here I am trying to use standard XI function inside udf.
Here is my code:
com.sap.aii.mappingtool.flib3.Arithm;
double conv1=0.0;
double Input=0.123456789;
Arithm ar = new Arithm()
conv1=ar.FormatNum();
Where I have to mention the property(like 0.00000) here?
You have to set parameters in the container:
Arithm ar = new Arithm();
String input = "1.23456789";
container.setParameter("nformat","0.00000");
container.setParameter("separator",".");
String output = ar.formatNumber(input,container);
Note that all functions of the graphical mapping tool work on String.
The formatNumber uses the standard class java.text.DecimalFormat.
You might use that class directly.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't really understand about standard XI function inside udf
Anyway UDF is a piece of java code. You can use any java classes.
for your requirement, why not just convert the number into string and take the first 5 characters after the char '.' and then convert the result string into number?
Jayson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
in this case they have to be set in the container parameters.
It's explained here:
/people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes
Regards
Patrick
Edited by: Patrick Koehnen on Jan 7, 2009 3:55 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 |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.