Appendix : Legacy Presto components : Mashables and Mashups : Mashups in EMML : Writing Mashups in EMML : Constructing the Mashup Result, Inputs or Intermediate Variables : <appendresult> : <appendresult> Examples
<appendresult> Examples
<appendresult> Basics
You set the variable to be updated in outputvariable. With <appendresult>, this variable must already exist. It can be empty or already have a root node to append into. Then define the well-formed content to be added. For example:

<mashup ...
xmlns:res="http://www.myCompany.com/myresults">
...
<variables>
<variable name="result" type="document"/>
</variables>
...
<foreach variable="review" items="$reviews//amz:CustomerReviews/amz:Review">
<appendresult outputvariable="$result">
<res:reviewer>
<res:name>{string($review//amz:Reviewer/amz:Name)}</res:name>
<res:rating>{$review//amz:Rating}</res:rating>
</res:reviewer>
</appendresult>
</foreach>
The literal XML content for <appendresult> must be well formed - completely wrapped in a root node. You use literal values or Dynamic Mashup Expressions to define the data that will fill this structure.
Root Nodes for Well-formed Documents from <appendresult>
If the output variable for <appendresult> has a root node already defined, <appendresult> adds repeating items as children of the root node. For example:

<mashup ...
xmlns:res="http://www.myCompany.com/myresults">
...
<variables>
<variable name="myReviews" type="document">
<res:reviews/>
</variable>
</variables>

<foreach variable="review" items="$reviews//amz:CustomerReviews/amz:Review">
<appendresult outputvariable="$myReviews">
<res:reviewer>
<res:name>{string($review//amz:Reviewer/amz:Name)}</res:name>
<res:rating>{$review//amz:Rating}</res:rating>
</res:reviewer>
</appendresult>
</foreach>
If the variable does not have a root node predefined, <appendresult> adds <xml> as a default root node to ensure the result is a well-formed document.
Working Samples
Several sample mashups use the <appendresult> statement. Some of particular interest include:
*DateTimeOperations (datetime.emml) for an example with a variety of XPath expressions to build the result
*GoogleFinanceNews (googlefinancenews.emml) for an example with <foreach>
*GroupByService (groupby2.emml) for an example of grouping and aggregation using <foreach> and <appendresult>
*VariableScoping (scope.emml) for an example within <parallel>
See Mashup Samples for a list of Business Analytics mashup samples and where to find them.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback