on 01-08-2008 9:45 AM
Hi,
I have a input value like 20070913 and i need to change it to the format 2.0070913E7. I am using arithmetic function FormatNum for this. I gave the Number format as 0.#######E0. Its working fine for all conditions but when the input value is something like 00010101, its results in 1.0101E4..I require the output as 0.0010101E7.
Pls help me solving this issue.
Regards,
Radhika
Hello Radhika,
I think this problem can be solved with a simple UDF, with one parameter, like:
Regards,
Andre Sousa
double d = Double.parseDouble(a);
double resultado = d;
int shiftCount = 0;
int pos = 0;
if (a.length() > 0) {
while (a.charAt(pos) == '0') {
shiftCount++;
pos++;
}
}
while (d >= 10) {
shiftCount++;
d = d / 10;
}
String givenNumber = a;
givenNumber = givenNumber.replaceFirst("[.]+","");
String result = new StringBuffer(givenNumber).insert(1, ".").toString();
return result + "E" + shiftCount;
Edited by: Andre Sousa on Jan 8, 2008 4:11 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try to use UDF because leading Zeros are trunckated,
check some links for UDF.
http://flickr.com/photos/8764045@N06/
Example 1
http://www.flickr.com/photo_zoom.gne?id=544183191&size=o
http://www.flickr.com/photo_zoom.gne?id=544183195&size=o
http://www.flickr.com/photo_zoom.gne?id=544183225&size=o
http://www.flickr.com/photo_zoom.gne?id=544183233&size=o
Example 2
http://www.flickr.com/photo_zoom.gne?id=545133789&size=o
http://www.flickr.com/photo_zoom.gne?id=545133791&size=o
http://www.flickr.com/photo_zoom.gne?id=545133801&size=o
http://www.flickr.com/photo_zoom.gne?id=545133807&size=o
http://www.flickr.com/photo_zoom.gne?id=545133811&size=o
http://www.flickr.com/photo_zoom.gne?id=545138911&size=o
http://www.flickr.com/photo_zoom.gne?id=545138913&size=o
http://www.flickr.com/photo_zoom.gne?id=545138915&size=o
http://www.flickr.com/photo_zoom.gne?id=545138917&size=o
http://www.flickr.com/photo_zoom.gne?id=545138947&size=o
http://www.flickr.com/photo_zoom.gne?id=545138951&size=o
http://www.flickr.com/photo_zoom.gne?id=545005958&size=o
Example 3
http://www.flickr.com/photo_zoom.gne?id=549186611&size=o
http://www.flickr.com/photo_zoom.gne?id=549186651&size=o
http://java.sun.com/j2se/1.5.0/docs/api/
/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Regards,
phani
Reward points if Helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to use UDF for this.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
might be the leading 000 are truncated resulting this error. check the same with the input as 10101 and see if the same result is shown
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.