Integration

Get Involved. Join the Conversation.

Topic

    Mohana Gopal Selvam
    Subtraction functionAnswered
    Topic posted September 29, 2019 by Mohana Gopal SelvamSilver Crown: 22,500+ Points, tagged Mapping 
    72 Views, 12 Comments
    Title:
    Subtraction function
    Content:

    Hi,

    Requirement: I want to subtract two value from various response and show in the final response.

    Problem: One value coming as string, so I tried to convert as Decimal point. Since I could not use Number (Conversion) function in Subtract, I have used assigned operation and convert as Decimal point. But I got the below error. I noticed, assigned function output also String. 

    Response 1

    {
      "avlDeposit" : "978409.25"}

    Response 2

    {
      "holdingAmt" : 409.25
    }

    How to achieve this?

    Got the below error
    {
      "type" : "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1",
      "title" : "Internal Server Error",
      "detail" : "Internal server error. Please contact oracle support for details.",
      "o:errorCode" : "500",
      "o:errorDetails" : [ {
        "type" : "UnMappedFault:execute",
        "instance" : "<![CDATA[Please inspect the logs for more details. Initiating Request: <request_payload/>\n]]>",
        "title" : "faultName: {{http://schemas.oracle.com/bpel/extension}subLanguageExecutionFault}\nmessageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}\nparts: {{\nsummary=<summary>XPath expression failed to execute.\nAn error occurs while processing the XPath expression; the expression is ora:doXSLTransformForDoc('resources/processor_116/resourcegroup_119/req_388e98f6529b4d6297c27267df9e6b41.xsl', $messagecontext_15.parameters, 'ORDS_HoldingAmount', $messagecontext_84.parameters, 'holdingAmount_assignment_1', $messagecontext_141, 'FreeCom_PB_Check', $messagecontext_129.parameters, 'avl_deposit_assignment_1', $messagecontext_155)\nThe XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException: oramds:/deployed-composites/oracleinternalics/PORTAL_BALANCE_DELETE_rev01.00.0000/resources/processor_116/resourcegroup_119/req_388e98f6529b4d6297c27267df9e6b41.xsl&lt;Line 55, Column 186>: XML-23002: (Error) internal xpath error\nCheck the detailed root cause described in the exception message text and verify that the XPath query is correct.\n</summary>\n,code=<code>XPathExecutionError</code>}\ncause: {javax.xml.transform.TransformerException: oramds:/deployed-composites/oracleinternalics/PORTAL_BALANCE_DELETE_rev01.00.0000/resources/processor_116/resourcegroup_119/req_388e98f6529b4d6297c27267df9e6b41.xsl<Line 55, Column 186>: XML-23002: (Error) internal xpath error}\n",
        "o:errorPath" : "NA",
        "o:errorCode" : "NA"
      } ]
    }
    

    Thanks,

    Mohan

    Best Comment

    Hemanth Lakkaraju

    You can drag and drop required function on top of the existing entry.

    Comment

     

    • Hemanth Lakkaraju

      What is the expression you used that is giving error? This looks very straight formward - xsd:decimal(avlDeposit) - xsd:decimal(holdingAmt) should give you desired result.

    • Mohana Gopal Selvam

      Hi Hemanth,

      I have tried the subtraction function in mapping where I could not edit once I drop the fields.

      First question: Is it expected behavior?

      Now as you suggested, I have added the subtraction function in assignment.

      My second question here: Assignment output always String?

      Thanks,

      Mohan

      • Hemanth Lakkaraju

        I have tried the subtraction function in mapping where I could not edit once I drop the fields.Is it expected behavior?

        I cannot answer unless I see what you are doing and if that is right!

        My second question here: Assignment output always String?

        The variable type should tell you when you create it :) Aren't you seeing only string there?

    • Mohana Gopal Selvam

      Hi Hemanth,

      1.Can you able to add any function once you drop the field in Subtraction function in Mapping screen? 

      2. I can see only String.

      Thanks,

      Mohan

      • Monish Munot

        Mohan, is this variable already used? Can you try creating a new variable and check?

      • Hemanth Lakkaraju

        1. You cannot edit an expression that is mapped. Only literals can be edited. You can drag and drop required function on top of it. or delete the mapping and recreate as required.

        2. That means all the variables hold only string values (for now)

    • Mohana Gopal Selvam

      Hi Monish,

      I see string in the drop down always. I typed d (ecimal) & n (umber), nothing is changed. Even new variable.

      Thanks,

      Mohan

      • Jihane

        When you create a variable in the value add something like 1.123 (decimal value) without adding any quotation and try.

        • Mohana Gopal Selvam

          Hi Jihane,

          Since the variable data type is String, again we have to do conversion function when we do a subtraction. Am I right?

          Thanks,

          Mohan