2

I am performing an Arithmetic operation in my XPath Expression. In the below code, qty1 and qty2 are double, hence the result I get is double. I want to convert the result to an Integer and save it in a property. How can I achieve it in WSO2 Integration Studio?

<property name="RESULT_QTY" expression="($body/*[local-name()='Shipment']/*[local-name()='qty1'])-($body/*[local-name()='Shipment']/*[local-name()='qty2'])"/>

Ruby
  • 368
  • 1
  • 9

1 Answers1

2

You can do something like below.

<property name="double" scope="default" type="DOUBLE" value="10.0"/>
<property name="doubleString" scope="default" expression="$ctx:double" type="STRING"/>
<property expression="fn:substring-before($ctx:doubleString, '.')" name="integer" scope="default" />
ycr
  • 12,828
  • 2
  • 25
  • 45