Integrate Software AG Products Using Digital Event Services 10.4 | Integrate Software AG Products Using Digital Event Services | MashZone NextGen Help | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Writing Mashups in EMML | Transforming Intermediate Results | Adding User-Defined Scripting Code to Mashups | Access to Mashup Variables
 
Access to Mashup Variables
Scripting code can only add to or update the mashup variable returned as the output variable of <script>.
Groovy scripts can only access those mashup variables that you pass to <script> using the inputvariables attribute. JavaScript code can access any mashup variable. However, this can impact performance. It is a best practice to pass mashup variables to JavaScript code using the inputvariables attribute in <script>.
You can pass any number of variables in inputvariables, separated by commas. For example:
<script type="text/javascript" inputvariables="$Orders">
<![CDATA[
var myName = Orders.order.customer.firstname;
var orderID = Orders.order.@id;
var items = Orders..item \\contains all items in Orders
for each (i in items) {
totalprice += i.price * i.quantity;
}
Orders.order.item += <item><description>Catapult</description><price>139.95</price></item>;
]]>
</script>
...
<script type="ruby" src="myRubyScript.rb"
inputvariables="$feedData,$myDoc" outputvariable="$rubyResult"/>

Copyright © 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release