Convert xsd:double to xsd:decimal

Hi,
I have an incoming field which is xsd:double and I need to convert the field into xsd:decimal
For example:
Incoming field - 5.13964E11
Outgoing field - 513964000.00
Any ideas how to do this ??
Thanks
Colin.

Hi Colin,
you can create a target data type in which you can take outgoing field as string variable.....
then in msg mapping, make a small UDF in JAVA.......take your input field to it....
in UDF, cast the input to double..........then convert it to decimal.....then cast it back to string.......then output this string.......
then take output of UDF to target........so you will get outgoing field in decimal format as string............
Then you can process your target XML in your target system.
Thanks,
Rajeev Gupta
Message was edited by:
        RAJEEV GUPTA

Similar Messages

  • File Adapter: trailing space in field using XSD:Decimal in a CSV file

    Hi Folks,
    I have a problem which i am unable to understand fully.
    We have a SAP to file via XI scenario where a mail adapter is used. We are producing a CSV file as an mail attachment.
    The issue is all the decimal fields have an extra space before the next delimiter i.e. comma.
    The data type used in mapping is XSD:Decimal with 'fraction' set as 2.
    I have checked the source XML and there is no trailing spaces there. Initially i thought this might be due to doing the conversion using transformation beans in mail adapter, to rule this out i checked other files produced using FILE adapter they also appear to have same issue.
    I can't get my head around it, could not find any parameter i need to pass in content conversion either in MAIL adapter or FILE adapter to supress trailing space before the delimiter.
    I suppose this must have occured with others as well.
    Any directions would be greatly appreciated.
    Btw, we are on PI 7.0 and ECC 6
    -Praveen
    Edited by: - External Consultants Mouchel on Sep 15, 2009 5:34 PM

    Hi Mouchel,
    I personally didnot encounter this kind of issue with the file adapter at any point of time. I would suggest you to check the message mapping before and after payload in sxmb_moni. If you see in mapping you may not find out, so view the source in notepad and then see.
    Regards,
    ---Satish

  • How to convert .xsd file into corresponding .xml file?

    Hi,
    If any one of you know this, please let me know?
    Thanks,
    Veera

    You cannot convert XSD into an XML as it is already a XMl file, but it defines the rules and restrictions for other XML which abide them.

  • Error in running a function to convert coordinates in degrees to decimal for EXCEL VBA

    For your information, I have 3 cross-posts regarding this question - and all I can said there is still no firm solution regarding this error.
    1) http://stackoverflow.com/questions/27634586/error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-exc/27637367#27637367
    2) http://www.mrexcel.com/forum/excel-questions/826099-error-running-function-convert-coordinates-degrees-decimal-excel-visual-basic-applications.html#post4030377 
    3) http://www.excelguru.ca/forums/showthread.php?3909-Error-in-running-a-function-to-convert-coordinates-in-degrees-to-decimal-for-EXCEL-VB&p=16507#post16507
    and the story of the error is as below:
    Currently I am working on VBA excel to create a widget to verify coordinates whether it lies under the radius of ANOTHER predefined and pre-specified sets of coordinates.
    In the module, I want to convert the coordinates from degrees to decimal before doing the calculation - as the formula of the calculation only allow the decimal form of coordinates.
    However, each and every time I want to run the macros this error (Run-time error '5', invalid procedure call or argument) will appear. Then, the debug button will bring me to below line of coding:
    degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
    For your information, the full function is as below:
    Function Convert_Decimal(Degree_Deg As String) As Double
    'source: http://support.microsoft.com/kb/213449
    Dim degrees As Double
    Dim minutes As Double
    Dim seconds As Double
    Degree_Deg = Replace(Degree_Deg, "~", "°")
    degrees = Val(Left(Degree_Deg, InStr(1, Degree_Deg, "°") - 1))
    minutes = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "°") + 2, _
    InStr(1, Degree_Deg, "'") - InStr(1, Degree_Deg, "°") - 2)) / 60
    seconds = Val(Mid(Degree_Deg, InStr(1, Degree_Deg, "'") + _
    2, Len(Degree_Deg) - InStr(1, Degree_Deg, "'") - 2)) / 3600
    Convert_Decimal = degrees + minutes + seconds
    End Function
    Thank you.
    Your kind assistance and attention in this matter are highly appreciated.
    Regards,
    Nina.

    You didn't give an example of your input string but try the following
    Sub test()
    Dim s As String
    s = "180° 30' 30.5""""" ' double quote for seconds
    Debug.Print Deg2Dec(s) ' 180.508472222222
    End Sub
    Function Deg2Dec(sAngle As String) As Double
    Dim mid1 As Long
    Dim mid2 As Long
    Dim degrees As Long
    Dim minutes As Long
    Dim seconds As Double ' or Long if only integer seconds
    sAngle = Replace(sAngle, " ", "")
    mid1 = InStr(sAngle, "°")
    mid2 = InStr(sAngle, "'")
    degrees = CLng(Left$(sAngle, mid1 - 1))
    minutes = CLng(Mid$(sAngle, mid1 + 1, mid2 - mid1 - 1))
    seconds = Val(Mid$(sAngle, mid2 + 1, 10)) ' change 10 to 2 if only integer seconds
    Deg2Dec = degrees + minutes / 60 + seconds / 3600
    End Function
    As written the function assumes values for each of deg/min/sec are included with unit indicators as given. Adapt for your needs.
    In passing, for any work with trig functions you will probably need to convert the degrees to radians.

  • How to convert numeric data to binary decimal in java

    How to convert numeric data to binary decimal in java Pleas egive me code example

    There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.

  • How can i convert a double to float

    double gallons;
    double startOdometer;
    double endOdometer;
    double mpg;
    double miles;
    endOdometer = Double.parseDouble (inputs);
    miles = endOdometer - startOdometer;                                                                 
    mpg = (miles/gallons) ;
    gallons = miles/mpg;
    mpg = Float.parseFloat(double);

    You would use a cast.
    double d = 1.4;
    float f = (float) d;But why do you want to convert a double into a float and then store it back into a double?????

  • Is it possible to convert a float to two decimal places

    Can anyone help me to convert a float to two decimal places
    float f=16;
    System.out.println(f);
    It will print 16.0
    But I want to get printed as 16.00

    "convert" no, as no conversion is needed, obviously. Format the output, yes. Read the API for String and its printf method.

  • Convertion Hex String to 32bits Decimal floating point??

    Hi,
    I would like to know how to convert hexa like: 416b0ac3 in decimal 32bits floating-point. The result of this string is suppose to be 14.690127.
    So i must be able to do:
    From 32-bit Hexadecimal Representation To Decimal Floating-Point
    Thanks for your support
    RiderMerlin

    RiderMerlin
    You can use the typecast function to do this.
    David
    Message Edited by David Crawford on 09-06-2006 03:31 PM
    Attachments:
    Typecast to Single.jpg ‏6 KB

  • Converting a Double To A String

    Is it possible to convert a double to a string. I need to retrieve a double value from an array and display it as a label in an applet.
    How do I convert the double value to a string so that I can use it in the applet as a label?
    Thanks

    try this.
    double mydbl = 0;
    String mystr = null;
    mysstr=mydbl+"".trim();
    Paulthis one is nice paul, but it is also possible to do it that way:
    double d = 0;
    String dStr = Double.toString(d);see also API for classes Boolean, Character, Integer, Byte, Float, Short
    all primitives can easyli be turned int for in which you can print them out.

  • Converting a double to binary

    Hey all,
    I am having difficultly trying to devise a simple method for converting a double to its binary representation. The value that I am dealing with is ~10^32, so I cannot use int or long. Any advice/suggestions would be appreciated. Shanks.

    prometheuzz wrote:
    Boojum317 wrote:
    Value = 711051181013210910132971103265
    Calculated binary = 100011000100001111100110000111110000000110000000100101001101011
    Value of calculated binary = 5.0535875047965512E18I am not checking your numbers, but I suspect you are confused how a floating point is represented in a binary notation. This is different than an integer value.
    Read the link that was posted earlier in your thread.Indeed.
    Long.toBinaryString(Double.doubleToLongBits(1.0))
    gives
    11111111110000000000000000000000000000000000000000000000000000which is correct.

  • How can I convert a double to string

    Hello,
    how can I convert a double value to a string value?
    Werner

    an other way: ;)
    double yourDouble;
    int intTmp;
    yourDouble = yourDouble * 100;
    yourDouble = yourDouble + 0.5;
    intTmp = yourDouble.intValue();
    yourDouble = intTmp;
    yourDouble = yourDouble / 100;you can write it some shorter...
    double yourDouble;
    int intTmp;
    yourDouble = yourDouble * 100 + 0.5;
    yourDouble = yourDouble.intValue() / 100;*100 moves the comma about two steps to the left.
    + 0.5 enables rounding!
    if your value is x.5 or larger you get x+1.?
    if its smaller than x.5 you get x.?
    by parsing the double value to an int the ? is cut.
    /100 moves the comma two steps back
    you get a double value with 2 decimals which is rounded.
    just my coins :)
    happy progging,
    Thof

  • How do i convert a double array (with spaces and tabs) to a string?

    Hi
    In our files, we have a mixture of spaces and tabs as a delimeter. How do I convert a double array into a string?
    Thank you.

    Not sure about the last part of your question.
    The Search and Replace pattern can be better than the simple Search and Replace string when you have to do complex searchs, such as detecting multiple spaces.
    Have a look at the attachment.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    ReplaceSpaces.vi ‏27 KB

  • Convert XSD to POJO

    Hi all,
    I would like to convert a xml schema file (.xsd) to corresponding JAVA objects without using any 3pps like JAXB or XMLBeans. I can probably write down the POJO (getters and setters) for each element/attribute corresponding to the xsd file. But, without using any of the either JAXB APIs or XMLBeans APIs, how can i parse the xml document contents to the POJO that I have created earlier?
    Please let me know if this is possible or any other means to achieve the same.
    Thanks in advance!!

    XSD is XML schema definition. You probably want to serialize to XML.
    Find in the Javadoc [http://java.sun.com/javase/6/docs/api/] the JAXBContext class...

  • Formatting a Double to 2 decimal places without first converting to String

    Hi,
    Does anyone have any clear idea on how to format a Double directly without first converting it
    to a String.I have just read through DecimalFormat/NumberFormat but I think there might be an easier way.I am also aware of printf(%f) and format(%f),but unfortunately am using Java 1.4 at the moment which does not seem to support them(will upgrade soon).The code I have is as follows:
    public void displayAnalysis ()
           System.out.println ("========================================================================");
           System.out.println ("========================================================================");
           System.out.println ("\nANALYSIS RESULTS FOR FILE " + inputFile + " \n");
           System.out.println ("========================================================================");
           System.out.println ("========================================================================");
           System.out.println ("\nString length: "+ inputText.length());
           System.out.println ("Ratio of printing to non-printing characters: "+ pRatio);
           System.out.println ("Ratio of vowels to consonants: "+ vRatio);
           System.out.println ("");
           System.out.println ("Frequency of vowels as a percentage of number of printing characters;");
           System.out.println ("Percentage of a's ="+ (NumberFormat.format(new DecimalFormat(((double)frequency[0]*100)/printable)))));
           System.out.println ("Percentage of e's ="+ ((double)frequency[1]*100)/printable + "%");
           System.out.println ("Percentage of i's ="+ ((double)frequency[2]*100)/printable + "%");
           System.out.println ("Percentage of o's ="+ ((double)frequency[3]*100)/printable + "%");
           System.out.println ("Percentage of u's ="+ ((double)frequency[4]*100)/printable + "%");
           System.out.println ("Number of whitespace characters were " + whitespace);
           System.out.println ("");
           System.out.println ("========================================================================");
           System.out.println ("========================================================================");
           System.out.println ("");
           System.out.println ("");
       }I would like to display the frequencies to 2 decimal places.As a last resort I will have to alter the code to use DecimalFormat,but I'm hoping someone has a simpler solution.

    Oops,please ignore the line for the first frequency (a's),I was just playing around with trying to use NumberFormat!

  • Converter XSD-XML  &  XML-XSD

    Hi,
    I am looking for a piece of code for
    a) creating an XML file by given an XSD schema
    b) creating an XSD file by given an XML document
    The given files are dynamically.
    The exported files can be good as possible.
    There are many discussions on internet, unfortunatelly without usefull code fragment.
    Is a simple converting of xsd->xml and xml->xsd a big problem?
    (Of course user needs to modify the converted file, so that it makes also semantically sense. )
    Thanks
    Aykut

    Originally posted by: alexm.xxx.yyy
    The Agent Controller is configured with Java 1.5 (I assume, the Window >
    Preferences is the place to do it.) Java 1.6 is not used in my Eclipse
    setup at all.
    Still, the "Java 1.5-" data collector is nowhere to be found.
    For now, I am using The Java Heap Analysis Tool (HAT), which provides
    the object allocation and retention stats, but getting TPTP to work
    would be a much more preferred choice.
    Thanks,
    Alex
    Asaf Yaffe wrote:
    > Alex,
    >> Asaf,
    >>
    >> Thank you for the response. For some reason, my profiler dialog only
    >> shows "Java Profiling - JRE 1.5 or newer..." option in the Monitor tab.
    >>
    >> Do I need to tweak something in my environment to get the JRE 1.5-
    >> entry in the list?
    >
    > Make sure that the Agent Controller (integrated or standalone, depending
    > on your configuration) is configured with a Java 1.5 or 1.4 JVM. If your
    > default environment (Eclipse) is using Java 1.6, then the "Java 1.5-"
    > data collector will not be available.
    >
    >
    >>
    >> Also, how can one get the object references in Java 1.5+?
    >>
    >
    > Sorry, but this capability is not currently supported in our Java 1.5+
    > collector.
    >
    > HTH,
    > Asaf
    >

Maybe you are looking for

  • Sending photos by email on E71x

    After taking photos by E71x I am unable to send them via email from it.

  • I just bought an I pad from someone how do I register it in my name

    Hi.  I just bought this new iPad from someone.  I'm trying to register it in my name. Does someone know how I do that?

  • Sourcing of GOA in Extended Classic Scenario

    Hello all, We are using the <u>extended classic scenario</u> with both Purchase Contracts and Global Outline agreements. Is it possible to use the GOA in the back-end as a source of supply in the sourcing transaction in SRM? What setting do I have to

  • APIC Setting

    Hi all, Posted this question a while ago and never got any replies - I'm still searching for an answer with no luck. A while ago I posted a problem regarding low cpu performance when benchmarking, which is now solved. I checked my IRQ's and noticed '

  • HTML Display without Report Templates

    Hi all I am saving html page (with all data and formats) in a table. On next step I will query this table and will display this column and will disply it on the region. But I dont want to use HTMLDB report templates. Because I want to control the for