Hi Mike,
Please try using the number() function instead of string()
Similar to:
<assign fromexpr="$result/*:financeData/*:investment/number()"
outputvariable="intitialInvestment" />
This should give you a numeric value of the data inside the specific tag (<investment> in this case)
-Mythri
Hi Mike,
number() supports decimal operations as well. You can perform arithmetic operations as well. Hope this code snippet helps:
<assign fromexpr="$result/*:financeData/*:yearsCompounded/number()"
outputvariable="yearsCompounded" />
<assign fromexpr="$result/*:financeData/*:rate/number()"
outputvariable="iRate" />
<assign fromexpr="$iRate*$yearsCompounded" outputvariable="multiply"/>
<display message="multiply::" variable="multiply"/>
value in 'multiply' in this case is 0.01
Thanks,
Mythri
I'm debugging it using the Eclipse Plugin for Mashup studio. Whenever I put "string()" as the function, the data reads from the document fine. However whenever I put "number()" it will not process the data. Ive attached some screenshots, perhaps that will help to narrow down the problem. I have print outs of the mashup studio debugger "variables" tab open for both using the "string()" and "number()" function.
Thanks guys!
Never Mind I figured it out! It would just seem the variable checker in the mashup studio doesn't display numerical data, while it does show string data. I had somthing else wrong with the code, and I thought it had to do with the variables because they wern't showing.
Thanks!



Hello, Im trying to make a macro that takes in a document, formatted like this example:
<financeData>
<investment>10000.0</investment>
<compoundPY>4.0</compoundPY>
<yearsCompounded>1.0</yearsCompounded>
<rate>0.01</rate>
</financeData>
It is to be used to calculate compound interest. I currently have a trival mash, that all its doing is when invoked, gives this same Data.
When i recieve the data in my macro testing EMML file, I can successfully get the data into variables using this snippet of code:
<invoke service="testStuff" operation="Invoke" outputvariable="result" />
<assign fromexpr="$result/*:financeData/*:investment/string()"
outputvariable="intitialInvestment" />
<assign fromexpr="$result/*:financeData/*:compoundPY/string()"
outputvariable="compoundPerYear" />
<assign fromexpr="$result/*:financeData/*:yCompounded/string()"
outputvariable="yearsCompounded" />
<assign fromexpr="$result/*:financeData/*:rate/string()" outputvariable="iRate" />
However I need to process the data using arithmatic operations, preferably using them as decimal variables. I know there must be a simple way of converting the data to a decimal, I just can't figure out how. If some one could let me know that would be great! thanks for putting up with me!
-Mike
The Noobie Masher