MashZone NextGen 10.2 | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Writing Mashups in EMML | Declaring Mashup and Macro Variables and Parameters | Default and Constructed Values
 
Default and Constructed Values
Most parameters and variables are assigned data by an EMML statement or as parameters passed into the mashup or macro when it is invoked.
You can define default values for variables and parameters with a scalar datatype. Use the default attribute. You cannot set a default for variables or parameters with a complex datatype. For example:
<input name="queryDate" type="date" default="2007-03-01"/>
...
<variables>
<variable name="key" type="string" default="1SF8BTKBTXN6XP68BY02"/>
<variable name="httpResponse.Content-type" type="string"
default="text/csv; charset=UTF-8"
</variables>
You can, however, construct the data for a variable or parameter that has a complex datatype by defining the XML and data literally within <variable>, <input> or <output>.
Note: If you define the content of <output> using literal XML, this is the only output for the mashup or macro.
Add the XML within <variable>, <input> or <output> and enter the literal data. It is a good practice to define a separate namespace for this literal XML to clearly differentiate from EMML. For example:
<inputparam name="query">
<svc:query>
<svc:category>books</svc:category>
<svc:ranking>allResults<svc:ranking>
<svc:date>{$queryDate}</svc:date>
<svc:maximum>100</svc:maximum>
</svc:query>
</inputparam>
<variables>
<variable name="header" type="document">
<header>
<Authorization>GoogleLogin auth={$auth}</Authorization>
<Content-Type>application/atom+xml</Content-Type>
</header>
</variable>
<variable name="soapRequest" type="document"/>
<constructor outputvariable="soapRequest">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding" >
<soap:Header>{$soapHeader}</soap:Header>
<soap:Body>{$soapBody}</soap:Body>
</soap:Envelope>
</constructor>
</variables>
You can also construct variables with dynamic data using some EMML statements. See Constructing the Mashup Result, Inputs or Intermediate Variables for links and information.

Copyright © 2013-2018 | 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